Views
No views yet

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.[96, 192, 384, 384] vs [128, 256, 512, 512]).| Full Decoder | Small Decoder |
|---|---|
![]() | ![]() |
pip install git+https://github.com/huggingface/diffusers.git1import torch
2from diffusers import Flux2KleinPipeline, AutoencoderKLFlux2
3
4device = "cuda"
5dtype = torch.bfloat16
6
7vae = AutoencoderKLFlux2.from_pretrained("black-forest-labs/FLUX.2-small-decoder", torch_dtype=dtype)
8pipe = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-4B", vae=vae, torch_dtype=dtype)
9pipe.enable_model_cpu_offload()
10
11prompt = "A black cat holding a sign that says 'hello world' in typewriter font"
12image = pipe(
13 prompt=prompt,
14 height=1024,
15 width=1024,
16 guidance_scale=1.0,
17 num_inference_steps=4,
18 generator=torch.Generator(device=device).manual_seed(0)
19).images[0]
20image.save("flux-klein-small-decoder.png")