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
Commit ·
5b1b138
0
Parent(s):
Duplicate from black-forest-labs/FLUX.2-small-decoder
Browse filesCo-authored-by: huemin <huemin@users.noreply.huggingface.co>
- .gitattributes +39 -0
- README.md +96 -0
- compare_full_decoder.png +3 -0
- compare_small_decoder.png +3 -0
- comparison_panel.jpeg +3 -0
- config.json +45 -0
- diffusion_pytorch_model.safetensors +3 -0
- editing.jpg +3 -0
- full_encoder_small_decoder.safetensors +3 -0
- small_decoder.safetensors +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
compare_full_decoder.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
compare_small_decoder.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
editing.jpg filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
comparison_panel.jpeg filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
pipeline_tag: image-to-image
|
| 6 |
+
tags:
|
| 7 |
+
- text-to-image
|
| 8 |
+
- image-editing
|
| 9 |
+
- flux
|
| 10 |
+
- diffusion-single-file
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+
|
| 15 |
+
`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.
|
| 16 |
+
|
| 17 |
+
# **Key Features**
|
| 18 |
+
|
| 19 |
+
1. **~1.4x faster decoding** compared to the full decoder.
|
| 20 |
+
2. **~1.4x less VRAM** at decode time, enabling higher resolutions without running out of memory.
|
| 21 |
+
3. **~28M decoder parameters** (vs ~50M in the full decoder) thanks to narrower channel widths (`[96, 192, 384, 384]` vs `[128, 256, 512, 512]`).
|
| 22 |
+
4. **Minimal quality loss** — images are almost identical.
|
| 23 |
+
5. Available under the Apache 2.0 license.
|
| 24 |
+
|
| 25 |
+
Compatible with all open FLUX.2 models:
|
| 26 |
+
- [FLUX.2-klein-4B](https://huggingface.co/black-forest-labs/FLUX.2-klein-4B)
|
| 27 |
+
- [FLUX.2-klein-9B](https://huggingface.co/black-forest-labs/FLUX.2-klein-9B)
|
| 28 |
+
- [FLUX.2-klein-9b-kv](https://huggingface.co/black-forest-labs/FLUX.2-klein-9b-kv)
|
| 29 |
+
- [FLUX.2-dev](https://huggingface.co/black-forest-labs/FLUX.2-dev)
|
| 30 |
+
|
| 31 |
+
# **Comparison**
|
| 32 |
+
|
| 33 |
+
| Full Decoder | Small Decoder |
|
| 34 |
+
|:---:|:---:|
|
| 35 |
+
|  |  |
|
| 36 |
+
|
| 37 |
+
# **Usage**
|
| 38 |
+
|
| 39 |
+
```shell
|
| 40 |
+
pip install git+https://github.com/huggingface/diffusers.git
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
```python
|
| 44 |
+
import torch
|
| 45 |
+
from diffusers import Flux2KleinPipeline, AutoencoderKLFlux2
|
| 46 |
+
|
| 47 |
+
device = "cuda"
|
| 48 |
+
dtype = torch.bfloat16
|
| 49 |
+
|
| 50 |
+
vae = AutoencoderKLFlux2.from_pretrained("black-forest-labs/FLUX.2-small-decoder", torch_dtype=dtype)
|
| 51 |
+
pipe = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-4B", vae=vae, torch_dtype=dtype)
|
| 52 |
+
pipe.enable_model_cpu_offload()
|
| 53 |
+
|
| 54 |
+
prompt = "A black cat holding a sign that says 'hello world' in typewriter font"
|
| 55 |
+
image = pipe(
|
| 56 |
+
prompt=prompt,
|
| 57 |
+
height=1024,
|
| 58 |
+
width=1024,
|
| 59 |
+
guidance_scale=1.0,
|
| 60 |
+
num_inference_steps=4,
|
| 61 |
+
generator=torch.Generator(device=device).manual_seed(0)
|
| 62 |
+
).images[0]
|
| 63 |
+
image.save("flux-klein-small-decoder.png")
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
---
|
| 68 |
+
# Limitations
|
| 69 |
+
|
| 70 |
+
- This model is not intended or able to provide factual information.
|
| 71 |
+
- While the model can output text, text rendered may be inaccurate or subject to distortion.
|
| 72 |
+
- As a statistical model, this checkpoint may represent or amplify biases observed in the training data.
|
| 73 |
+
- The model may fail to generate output that matches the prompts.
|
| 74 |
+
- Prompt following is heavily influenced by the prompting style.
|
| 75 |
+
|
| 76 |
+
# Out-of-Scope Use
|
| 77 |
+
|
| 78 |
+
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.
|
| 79 |
+
|
| 80 |
+
---
|
| 81 |
+
# Responsible AI Development
|
| 82 |
+
|
| 83 |
+
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
|
| 84 |
+
Misuse](https://bfl.ai/blog/capable-open-and-safe-combating-ai-misuse).
|
| 85 |
+
|
| 86 |
+
To report safety concerns, contact safety@blackforestlabs.ai.
|
| 87 |
+
|
| 88 |
+
---
|
| 89 |
+
|
| 90 |
+
# License
|
| 91 |
+
|
| 92 |
+
This model is licensed under the https://www.apache.org/licenses/LICENSE-2.0.
|
| 93 |
+
|
| 94 |
+
# Trademarks & IP
|
| 95 |
+
|
| 96 |
+
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.
|
compare_full_decoder.png
ADDED
|
Git LFS Details
|
compare_small_decoder.png
ADDED
|
Git LFS Details
|
comparison_panel.jpeg
ADDED
|
Git LFS Details
|
config.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class_name": "AutoencoderKLFlux2",
|
| 3 |
+
"_diffusers_version": "0.32.0.dev0",
|
| 4 |
+
"in_channels": 3,
|
| 5 |
+
"out_channels": 3,
|
| 6 |
+
"down_block_types": [
|
| 7 |
+
"DownEncoderBlock2D",
|
| 8 |
+
"DownEncoderBlock2D",
|
| 9 |
+
"DownEncoderBlock2D",
|
| 10 |
+
"DownEncoderBlock2D"
|
| 11 |
+
],
|
| 12 |
+
"up_block_types": [
|
| 13 |
+
"UpDecoderBlock2D",
|
| 14 |
+
"UpDecoderBlock2D",
|
| 15 |
+
"UpDecoderBlock2D",
|
| 16 |
+
"UpDecoderBlock2D"
|
| 17 |
+
],
|
| 18 |
+
"block_out_channels": [
|
| 19 |
+
128,
|
| 20 |
+
256,
|
| 21 |
+
512,
|
| 22 |
+
512
|
| 23 |
+
],
|
| 24 |
+
"decoder_block_out_channels": [
|
| 25 |
+
96,
|
| 26 |
+
192,
|
| 27 |
+
384,
|
| 28 |
+
384
|
| 29 |
+
],
|
| 30 |
+
"layers_per_block": 2,
|
| 31 |
+
"act_fn": "silu",
|
| 32 |
+
"latent_channels": 32,
|
| 33 |
+
"norm_num_groups": 32,
|
| 34 |
+
"sample_size": 1024,
|
| 35 |
+
"force_upcast": true,
|
| 36 |
+
"use_quant_conv": true,
|
| 37 |
+
"use_post_quant_conv": true,
|
| 38 |
+
"mid_block_add_attention": true,
|
| 39 |
+
"batch_norm_eps": 0.0001,
|
| 40 |
+
"batch_norm_momentum": 0.1,
|
| 41 |
+
"patch_size": [
|
| 42 |
+
2,
|
| 43 |
+
2
|
| 44 |
+
]
|
| 45 |
+
}
|
diffusion_pytorch_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d8d52ba036475f5fb07c8b435e176d3d97ebfa82f0d1a1c317f9cc1e25bd013b
|
| 3 |
+
size 249521340
|
editing.jpg
ADDED
|
Git LFS Details
|
full_encoder_small_decoder.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ea4273f02d1fafbf8e1d1c2cf6018ed8748652eb0bf34f2dd91171f16f15ab62
|
| 3 |
+
size 249519092
|
small_decoder.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ad783347747561d974f347f1b7377ebca15330621ace6a2e3f8dfaa83f5c211f
|
| 3 |
+
size 111801980
|