Instructions to use InsecureErasure/FLUX.2-small-decoder-BF16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusion Single File
How to use InsecureErasure/FLUX.2-small-decoder-BF16 with Diffusion Single File:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
metadata
license: apache-2.0
language:
- en
pipeline_tag: image-to-image
tags:
- text-to-image
- image-editing
- flux
- diffusion-single-file
This is a BF16 conversion of black-forest-labs/FLUX.2-small-decoder, converted using diffusers and safetensors. Weights cast from FP32 to BF16; bn statistics preserved as-is.
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.4x faster decoding compared to the full decoder.
- ~1.4x less VRAM at decode time, enabling higher resolutions without running out of memory.
- ~28M decoder parameters (vs ~50M in the full decoder) thanks to narrower channel widths (
[96, 192, 384, 384]vs[128, 256, 512, 512]). - Minimal quality loss — images are almost identical.
- Available under the Apache 2.0 license.
Compatible with all open FLUX.2 models:
Usage
pip install git+https://github.com/huggingface/diffusers.git
import torch
from diffusers import Flux2KleinPipeline, AutoencoderKLFlux2
device = "cuda"
dtype = torch.bfloat16
vae = AutoencoderKLFlux2.from_pretrained("InsecureErasure/FLUX.2-small-decoder-BF16", 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")
License
This model is licensed under the https://www.apache.org/licenses/LICENSE-2.0.