File size: 1,817 Bytes
81b253b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
base_model: black-forest-labs/FLUX.1-dev
library_name: diffusers
license: other
license_name: flux-1-dev-non-commercial-license
license_link: https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md
pipeline_tag: text-to-image
tags:
- flux
- text-to-image
- quantized
- fp8
- e4m3
- diffusers
base_model_relation: quantized
---
# FLUX.1-dev-e4m3

FP8 (e4m3) dynamically-quantized [FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev),
saved as a complete `FluxPipeline`.

## What was changed

Every double and single transformer block of the `FluxTransformer2DModel` is
quantized to `e4m3_e4m3_dynamic` — `float8_e4m3fn` weights with dynamically
scaled `float8_e4m3fn` activations. The rest of the pipeline is unchanged: the
transformer's non-block tensors, the CLIP text encoder and the VAE stay in
fp16, and the T5 text encoder stays in bf16. The transformer shrinks from
~23.8 GB to ~12.0 GB.

This is the same recipe as
[`wavespeed/FLUX.1-dev-int8`](https://huggingface.co/wavespeed/FLUX.1-dev-int8)
with an fp8 rather than int8 numeric format. FP8 matmul needs Hopper (H100/H200)
or newer; on Ada and older the weights dequantize instead and you lose the speedup.

Quantization was done with WaveSpeed's `xelerate.ao.quantize`. Weights are
stored as pickled `.bin` shards, so loading requires `use_safetensors=False`.

## Usage

```python
import torch
from diffusers import FluxPipeline

pipe = FluxPipeline.from_pretrained(
    "wavespeed/FLUX.1-dev-e4m3",
    torch_dtype=torch.float16,
    use_safetensors=False,
).to("cuda")
```

## License

Derived from FLUX.1-dev, so the
[FLUX.1 \[dev\] Non-Commercial License](https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md)
applies to these weights and to anything generated with them. Not for
commercial use.