Image-to-Image
Diffusers
Diffusion Single File
English
fp8
unsloth
quantized
image-generation
image-editing
flux
Instructions to use unsloth/FLUX.2-dev-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use unsloth/FLUX.2-dev-FP8 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("unsloth/FLUX.2-dev-FP8", dtype=torch.bfloat16, device_map="cuda") prompt = "cute sloth typing on a computer (INT8)" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Diffusion Single File
How to use unsloth/FLUX.2-dev-FP8 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
- Local Apps Settings
- Unsloth Desktop
Add files using upload-large-folder tool
Browse files- README.md +24 -0
- transformer_fp8.pt +3 -0
- transformer_int8.pt +3 -0
README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FLUX.2-dev-quantized
|
| 2 |
+
|
| 3 |
+
Pre-quantized diffusion transformer checkpoints for black-forest-labs/FLUX.2-dev, built with torchao dynamic
|
| 4 |
+
activation quantization from the dense bf16 transformer.
|
| 5 |
+
|
| 6 |
+
Files:
|
| 7 |
+
- transformer_int8.pt (33.0 GB)
|
| 8 |
+
- transformer_fp8.pt (32.2 GB)
|
| 9 |
+
|
| 10 |
+
Details:
|
| 11 |
+
- int8: Int8DynamicActivationInt8WeightConfig (per-token activation, per-channel weight,
|
| 12 |
+
torch._int_mm).
|
| 13 |
+
- fp8: Float8DynamicActivationFloat8WeightConfig with PerRow granularity (e4m3,
|
| 14 |
+
torch._scaled_mm). The loader must floor the dynamic activation scale
|
| 15 |
+
(activation_value_lb=1e-12 on torchao 0.13+) so all-zero activation token rows cannot
|
| 16 |
+
produce a zero scale.
|
| 17 |
+
- Loading a checkpoint is bit-identical to quantizing the dense bf16 transformer on the fly;
|
| 18 |
+
the checkpoint only skips the dense load and quantize step.
|
| 19 |
+
- Checkpoint format: unsloth prequant transformer state dict, filename convention
|
| 20 |
+
transformer_<scheme>.pt.
|
| 21 |
+
- Validated against same-seed dense bf16 renders (SSIM, LPIPS-vgg, CLIP delta, non-finite and
|
| 22 |
+
black-frame checks) on torch 2.12.1 and torchao 0.17.
|
| 23 |
+
|
| 24 |
+
Note: Derived from FLUX.2-dev (gated). Keep private pending license review.
|
transformer_fp8.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b413368f9bc6682781dea272db549bcfb3dfb04552dc6bbe49658a9301684b51
|
| 3 |
+
size 32244884507
|
transformer_int8.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f1320b1ee0d886648d15b16b370ebe462f24380688255c7da2559b1a50261f74
|
| 3 |
+
size 32953600925
|