diffusers / FLUX.1-dev-torchao-int4

huggingface.co
Total runs: 7
24-hour runs: 0
7-day runs: -5
30-day runs: -9
Model's Last Updated: May 21 2025
text-to-image

Introduction of FLUX.1-dev-torchao-int4

Model Details of FLUX.1-dev-torchao-int4

Visual comparison of Flux-dev model outputs using BF16 and torchao int4_weight_only quantization

BF16
Flux-dev output with BF16: Baroque, Futurist, Noir styles torchao int4_weight_only
torchao int4_weight_only Output

Usage with Diffusers

To use this quantized FLUX.1 [dev] checkpoint, you need to install the 🧨 diffusers and torchao library:

pip install -U torchao

For now, we require this specific branch in diffusers library to fix an error when loading the model

pip install git+https://github.com/huggingface/diffusers.git@torchao-int4-serialization

After installing the required library, you can run the following script:

from diffusers import FluxPipeline

pipe = FluxPipeline.from_pretrained(
    "diffusers/FLUX.1-dev-torchao-int4",
    torch_dtype=torch.bfloat16,
    use_safetensors=False,
    device_map="balanced"
)

prompt = "Baroque style, a lavish palace interior with ornate gilded ceilings, intricate tapestries, and dramatic lighting over a grand staircase."

pipe_kwargs = {
    "prompt": prompt,
    "height": 1024,
    "width": 1024,
    "guidance_scale": 3.5,
    "num_inference_steps": 50,
    "max_sequence_length": 512,
}

image = pipe(
    **pipe_kwargs, generator=torch.manual_seed(0),
).images[0]

image.save("flux.png")

How to generate this quantized checkpoint ?

This checkpoint was created with the following script using "black-forest-labs/FLUX.1-dev" checkpoint:


import torch
from diffusers import FluxPipeline
from diffusers.quantizers import PipelineQuantizationConfig
from diffusers import TorchAoConfig as DiffusersTorchAoConfig
from transformers import TorchAoConfig as TransformersTorchAoConfig

pipeline_quant_config = PipelineQuantizationConfig(
    quant_mapping={
        "transformer": DiffusersTorchAoConfig("int4_weight_only"),
        "text_encoder_2": TransformersTorchAoConfig("int4_weight_only"),
    }
)

pipe = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-dev",
    quantization_config=pipeline_quant_config,
    torch_dtype=torch.bfloat16,
    device_map="balanced"
)

# safe_serialization set to `False` as we can't save torchao quantized model to safetensors format
pipe.save_pretrained("FLUX.1-dev-torchao-int4", safe_serialization=False)

Runs of diffusers FLUX.1-dev-torchao-int4 on huggingface.co

7
Total runs
0
24-hour runs
0
3-day runs
-5
7-day runs
-9
30-day runs

More Information About FLUX.1-dev-torchao-int4 huggingface.co Model

FLUX.1-dev-torchao-int4 huggingface.co

FLUX.1-dev-torchao-int4 huggingface.co is an AI model on huggingface.co that provides FLUX.1-dev-torchao-int4's model effect (), which can be used instantly with this diffusers FLUX.1-dev-torchao-int4 model. huggingface.co supports a free trial of the FLUX.1-dev-torchao-int4 model, and also provides paid use of the FLUX.1-dev-torchao-int4. Support call FLUX.1-dev-torchao-int4 model through api, including Node.js, Python, http.

FLUX.1-dev-torchao-int4 huggingface.co Url

https://huggingface.co/diffusers/FLUX.1-dev-torchao-int4

diffusers FLUX.1-dev-torchao-int4 online free

FLUX.1-dev-torchao-int4 huggingface.co is an online trial and call api platform, which integrates FLUX.1-dev-torchao-int4's modeling effects, including api services, and provides a free online trial of FLUX.1-dev-torchao-int4, you can try FLUX.1-dev-torchao-int4 online for free by clicking the link below.

diffusers FLUX.1-dev-torchao-int4 online free url in huggingface.co:

https://huggingface.co/diffusers/FLUX.1-dev-torchao-int4

FLUX.1-dev-torchao-int4 install

FLUX.1-dev-torchao-int4 is an open source model from GitHub that offers a free installation service, and any user can find FLUX.1-dev-torchao-int4 on GitHub to install. At the same time, huggingface.co provides the effect of FLUX.1-dev-torchao-int4 install, users can directly use FLUX.1-dev-torchao-int4 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

FLUX.1-dev-torchao-int4 install url in huggingface.co:

https://huggingface.co/diffusers/FLUX.1-dev-torchao-int4

Url of FLUX.1-dev-torchao-int4

FLUX.1-dev-torchao-int4 huggingface.co Url

Provider of FLUX.1-dev-torchao-int4 huggingface.co

diffusers
ORGANIZATIONS

Other API from diffusers

huggingface.co

Total runs: 46.7K
Run Growth: 0
Growth Rate: 0.00%
Updated:October 22 2024
huggingface.co

Total runs: 3.0K
Run Growth: 355
Growth Rate: 11.94%
Updated:February 08 2023
huggingface.co

Total runs: 645
Run Growth: 125
Growth Rate: 19.38%
Updated:February 24 2025
huggingface.co

Total runs: 40
Run Growth: 9
Growth Rate: 22.50%
Updated:January 27 2023
huggingface.co

Total runs: 12
Run Growth: 7
Growth Rate: 58.33%
Updated:February 07 2024