Instructions to use wavespeed/FLUX.1-dev-e4m3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use wavespeed/FLUX.1-dev-e4m3 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("wavespeed/FLUX.1-dev-e4m3", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Add model card metadata: base_model, license, pipeline_tag, tags
Browse files
README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: black-forest-labs/FLUX.1-dev
|
| 3 |
+
library_name: diffusers
|
| 4 |
+
license: other
|
| 5 |
+
license_name: flux-1-dev-non-commercial-license
|
| 6 |
+
license_link: https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md
|
| 7 |
+
pipeline_tag: text-to-image
|
| 8 |
+
tags:
|
| 9 |
+
- flux
|
| 10 |
+
- text-to-image
|
| 11 |
+
- quantized
|
| 12 |
+
- fp8
|
| 13 |
+
- e4m3
|
| 14 |
+
- diffusers
|
| 15 |
+
base_model_relation: quantized
|
| 16 |
+
---
|
| 17 |
+
# FLUX.1-dev-e4m3
|
| 18 |
+
|
| 19 |
+
FP8 (e4m3) dynamically-quantized [FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev),
|
| 20 |
+
saved as a complete `FluxPipeline`.
|
| 21 |
+
|
| 22 |
+
## What was changed
|
| 23 |
+
|
| 24 |
+
Every double and single transformer block of the `FluxTransformer2DModel` is
|
| 25 |
+
quantized to `e4m3_e4m3_dynamic` — `float8_e4m3fn` weights with dynamically
|
| 26 |
+
scaled `float8_e4m3fn` activations. The rest of the pipeline is unchanged: the
|
| 27 |
+
transformer's non-block tensors, the CLIP text encoder and the VAE stay in
|
| 28 |
+
fp16, and the T5 text encoder stays in bf16. The transformer shrinks from
|
| 29 |
+
~23.8 GB to ~12.0 GB.
|
| 30 |
+
|
| 31 |
+
This is the same recipe as
|
| 32 |
+
[`wavespeed/FLUX.1-dev-int8`](https://huggingface.co/wavespeed/FLUX.1-dev-int8)
|
| 33 |
+
with an fp8 rather than int8 numeric format. FP8 matmul needs Hopper (H100/H200)
|
| 34 |
+
or newer; on Ada and older the weights dequantize instead and you lose the speedup.
|
| 35 |
+
|
| 36 |
+
Quantization was done with WaveSpeed's `xelerate.ao.quantize`. Weights are
|
| 37 |
+
stored as pickled `.bin` shards, so loading requires `use_safetensors=False`.
|
| 38 |
+
|
| 39 |
+
## Usage
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
import torch
|
| 43 |
+
from diffusers import FluxPipeline
|
| 44 |
+
|
| 45 |
+
pipe = FluxPipeline.from_pretrained(
|
| 46 |
+
"wavespeed/FLUX.1-dev-e4m3",
|
| 47 |
+
torch_dtype=torch.float16,
|
| 48 |
+
use_safetensors=False,
|
| 49 |
+
).to("cuda")
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
## License
|
| 53 |
+
|
| 54 |
+
Derived from FLUX.1-dev, so the
|
| 55 |
+
[FLUX.1 \[dev\] Non-Commercial License](https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md)
|
| 56 |
+
applies to these weights and to anything generated with them. Not for
|
| 57 |
+
commercial use.
|