FLUX.2 small decoder

Providerblack-forest-labs
Categoryimage-to-image
Licenseapache-2.0
Downloads2.7K
Stars4

Overview

FLUX.2 small decoder is a streamlined image-to-image component designed for developers who need efficient latent space reconstruction without the overhead of full-scale diffusion models. Unlike heavy generative pipelines, this decoder focuses on translating compressed representations back into high-fidelity visual data. It is particularly useful for building custom image editing workflows, optimizing inference latency in production environments, and integrating high-quality decoding into existing generative AI stacks. By leveraging the Apache-2.0 license, it offers a flexible foundation for both commercial and open-source projects requiring a balance between computational speed and output clarity.

Highlights

  • Optimized for low-latency image-to-image reconstruction
  • Apache-2.0 license ensures flexible commercial deployment
  • Seamless integration into existing latent diffusion pipelines
  • Reduced memory footprint compared to full-scale decoders

Usage

Install
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# Load model with transformers
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("black-forest-labs/FLUX.2-small-decoder")
tokenizer = AutoTokenizer.from_pretrained("black-forest-labs/FLUX.2-small-decoder")

Hugging Face Download

We recommend downloading the model via the Hugging Face CLI or Hub SDK.

Guidance:Before downloading, install huggingface_hub with:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

Download the full repository
huggingface-cli download black-forest-labs/FLUX.2-small-decoder

Download a single file to a local folder (e.g. config.json into ./dir)

Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download black-forest-labs/FLUX.2-small-decoder config.json --local-dir ./dir

See the official docs for more CLI options

SDK Download

SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('black-forest-labs/FLUX.2-small-decoder')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://huggingface.co/black-forest-labs/FLUX.2-small-decoder

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/black-forest-labs/FLUX.2-small-decoder

Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.

PyTorch / Transformers Usage

Install Transformers

Install Transformers
pip install -U transformers torch

Load the model and run inference

Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('black-forest-labs/FLUX.2-small-decoder')
tokenizer = AutoTokenizer.from_pretrained('black-forest-labs/FLUX.2-small-decoder')

Model Download

We recommend downloading the model via the ModelScope CLI or SDK.

Guidance:Before downloading, install ModelScope with:

Guidance
pip install modelscope

CLI Download

Download the full repository

Download the full repository
modelscope download --model black-forest-labs/FLUX.2-small-decoder

Download a single file to a local folder (e.g. README.md into ./dir)

Download a single file to a local folder (e.g. README.md into ./dir)
modelscope download --model black-forest-labs/FLUX.2-small-decoder README.md --local_dir ./dir

See the docs for more CLI options

SDK Download

SDK Download
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('black-forest-labs/FLUX.2-small-decoder')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://www.modelscope.cn/black-forest-labs/FLUX.2-small-decoder.git

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/black-forest-labs/FLUX.2-small-decoder.git

ModelScope 模型页直接下载模型文件;无需将模型文件放在本站服务器。

Notebook Quickstart

Install the ModelScope library

Install the ModelScope library
pip install "modelscope[audio,cv,nlp,multi-modal,science]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

Load the model and run inference

Load the model and run inference
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = pipeline('text-generation', 'black-forest-labs/FLUX.2-small-decoder')

Full Documentation

来源: HuggingFace

---
license: apache-2.0
language:

  • en

pipeline_tag: image-to-image
tags:
  • text-to-image

  • image-editing

  • flux

  • diffusion-single-file

---

!Comparison Panel

FLUX.2 Small Decoder is a distilled VAE decoder that serves as a drop-in replacement for the standard FLUX.2 decoder. It delivers faster decoding and lower VRAM usage with minimal to zero quality loss. The encoder remains unchanged.

Key Features

1. ~1.4x faster decoding compared to the full decoder.
2. ~1.4x less VRAM at decode time, enabling higher resolutions without running out of memory.
3. ~28M decoder parameters (vs ~50M in the full decoder) thanks to narrower channel widths ([96, 192, 384, 384] vs [128, 256, 512, 512]).
4. Minimal quality loss — images are almost identical.
5. Available under the Apache 2.0 license.

Compatible with all open FLUX.2 models:




Comparison

| Full Decoder | Small Decoder |
|:---:|:---:|
| !Full Decoder | !Small Decoder |

Usage

shell
pip install git+https://github.com/huggingface/diffusers.git
python
import torch
from diffusers import Flux2KleinPipeline, AutoencoderKLFlux2

device = "cuda"
dtype = torch.bfloat16

vae = AutoencoderKLFlux2.from_pretrained("black-forest-labs/FLUX.2-small-decoder", torch_dtype=dtype)
pipe = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-4B", vae=vae, torch_dtype=dtype)
pipe.enable_model_cpu_offload()

prompt = "A black cat holding a sign that says 'hello world' in typewriter font"
image = pipe(
prompt=prompt,
height=1024,
width=1024,
guidance_scale=1.0,
num_inference_steps=4,
generator=torch.Generator(device=device).manual_seed(0)
).images[0]
image.save("flux-klein-small-decoder.png")

---

Limitations

  • This model is not intended or able to provide factual information.
  • While the model can output text, text rendered may be inaccurate or subject to distortion.
  • As a statistical model, this checkpoint may represent or amplify biases observed in the training data.
  • The model may fail to generate output that matches the prompts.
  • Prompt following is heavily influenced by the prompting style.

Out-of-Scope Use

This model and its derivatives may not be used outside the scope of the license, including for unlawful, fraudulent, defamatory, abusive, or otherwise violative purposes as further explained in our Usage Policies.

---

Responsible AI Development

Black Forest Labs is committed to responsible model development and deployment. Prior to releasing FLUX.2 [klein] 9B-KV, we evaluated and mitigated a number of risks, including child sexual abuse material (CSAM) and nonconsensual intimate imagery (NCII). For detailed information about our mitigations, evaluation processes, content provenance features, and policies, please see our post: Capable, Open, and Safe: Combating AI
Misuse
.

To report safety concerns, contact [email protected].

---

License

This model is licensed under the https://www.apache.org/licenses/LICENSE-2.0.

Trademarks & IP

This project may contain trademarks or logos for projects, products, or services. Use of Black Forest Labs and FLUX trademarks or logos in modified versions of this project must not cause confusion or imply sponsorship or endorsement. Any use of third-party trademarks, intellectual property or logos are subject to those third-party's policies.

Join our Telegram