Update README.md
Browse files
README.md
CHANGED
|
@@ -14,6 +14,25 @@ This is a BF16 conversion of [`black-forest-labs/FLUX.2-small-decoder`](https://
|
|
| 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.
|
|
@@ -28,35 +47,6 @@ Compatible with all open FLUX.2 models:
|
|
| 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 |
-
# **Usage**
|
| 32 |
-
|
| 33 |
-
```shell
|
| 34 |
-
pip install git+https://github.com/huggingface/diffusers.git
|
| 35 |
-
```
|
| 36 |
-
|
| 37 |
-
```python
|
| 38 |
-
import torch
|
| 39 |
-
from diffusers import Flux2KleinPipeline, AutoencoderKLFlux2
|
| 40 |
-
|
| 41 |
-
device = "cuda"
|
| 42 |
-
dtype = torch.bfloat16
|
| 43 |
-
|
| 44 |
-
vae = AutoencoderKLFlux2.from_pretrained("InsecureErasure/FLUX.2-small-decoder-BF16", torch_dtype=dtype)
|
| 45 |
-
pipe = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-4B", vae=vae, torch_dtype=dtype)
|
| 46 |
-
pipe.enable_model_cpu_offload()
|
| 47 |
-
|
| 48 |
-
prompt = "A black cat holding a sign that says 'hello world' in typewriter font"
|
| 49 |
-
image = pipe(
|
| 50 |
-
prompt=prompt,
|
| 51 |
-
height=1024,
|
| 52 |
-
width=1024,
|
| 53 |
-
guidance_scale=1.0,
|
| 54 |
-
num_inference_steps=4,
|
| 55 |
-
generator=torch.Generator(device=device).manual_seed(0)
|
| 56 |
-
).images[0]
|
| 57 |
-
image.save("flux-klein-small-decoder.png")
|
| 58 |
-
```
|
| 59 |
-
|
| 60 |
---
|
| 61 |
# License
|
| 62 |
|
|
|
|
| 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 |
+
Both images below have been generated using FLUX.2 Klein NVFP4 with BF16 VAEs.
|
| 18 |
+
|
| 19 |
+
<table style="width:auto">
|
| 20 |
+
<tr>
|
| 21 |
+
<td align="center"><img src="./images/flux2-vae-small.png" style="width:45%"/></td>
|
| 22 |
+
<td align="center"><img src="./images/flux2-vae.png" style="width:45%"/></td>
|
| 23 |
+
</tr>
|
| 24 |
+
<tr>
|
| 25 |
+
<td align="center"><b>FLUX.2 VAE small</b></td>
|
| 26 |
+
<td align="center"><b>FLUX.2 VAE</b></td>
|
| 27 |
+
</tr>
|
| 28 |
+
</table>
|
| 29 |
+
|
| 30 |
+
**Prompt**
|
| 31 |
+
<pre>A black cat holding a sign that says 'hello world' in typewriter font</pre>
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
# **Key Features**
|
| 37 |
|
| 38 |
1. **~1.4x faster decoding** compared to the full decoder.
|
|
|
|
| 47 |
- [FLUX.2-klein-9b-kv](https://huggingface.co/black-forest-labs/FLUX.2-klein-9b-kv)
|
| 48 |
- [FLUX.2-dev](https://huggingface.co/black-forest-labs/FLUX.2-dev)
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
---
|
| 51 |
# License
|
| 52 |
|