diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

[wip] Higgs quantization

Open sayakpaul opened this issue 8 months ago • 1 comments

What does this PR do?

Testing code:

from diffusers import DiffusionPipeline, AutoModel
from diffusers.quantizers.quantization_config import HiggsConfig
import torch 

ckpt_id = "black-forest-labs/FLUX.1-dev"
transformer = AutoModel.from_pretrained(
    ckpt_id, 
    subfolder="transformer", 
    quantization_config=HiggsConfig(modules_to_not_convert=["x_embedder"]), 
    torch_dtype=torch.bfloat16,
    device_map="cuda"
)
pipe = DiffusionPipeline.from_pretrained(
    ckpt_id, 
    transformer=transformer,
    torch_dtype=torch.bfloat16
).to("cuda")

pipe_kwargs = {
    "prompt": "A cat holding a sign that says hello world",
    "height": 1024,
    "width": 1024,
    "guidance_scale": 3.5,
    "num_inference_steps": 28,
    "max_sequence_length": 512,
    "generator": torch.manual_seed(0),
}
image = pipe(**pipe_kwargs).images[0]
image.save("higgs.png")

Cc: @SunMarc @Mekkcyber

sayakpaul avatar Jun 24 '25 12:06 sayakpaul

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Gently pinging @SunMarc @MekkCyber now that the big OSS release is done.

sayakpaul avatar Aug 06 '25 14:08 sayakpaul