mit-han-lab / nunchaku

SVDQuant: Absorbing Outliers by Low-Rank Components for 4-Bit Diffusion Models
https://hanlab.mit.edu/projects/svdquant
Apache License 2.0
351 stars 17 forks source link

New Flux Fill Support #34

Open chuck-ma opened 3 days ago

chuck-ma commented 3 days ago

https://github.com/huggingface/diffusers/pull/9985

https://huggingface.co/black-forest-labs/FLUX.1-Fill-dev

FLUX.1 Fill [dev] is a 12 billion parameter rectified flow transformer capable of filling areas in existing images based on a text description

here is how to call it through diffusers api:

import torch
from diffusers import FluxFillPipeline
from diffusers.utils import load_image

img = load_image("/raid/yiyi/flux-new/assets/cup.png")
mask = load_image("/raid/yiyi/flux-new/assets/cup_mask.png")

repo_id = "diffusers-internal-dev/dummy-fill"

pipe = FluxFillPipeline.from_pretrained(repo_id, torch_dtype=torch.bfloat16)
pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power

image = pipe(
    prompt="a white paper cup",
    image=img,
    mask_image=mask,
    height=1632,
    width=1232,
    guidance_scale=30,
    num_inference_steps=50,
    max_sequence_length=512,
    generator=torch.Generator("cpu").manual_seed(0)
).images[0]
image.save("yiyi_test_2_out.png")

If the quantification of this flux fill can be supported, it will be of considerable help.

lmxyy commented 17 hours ago

Looking at it now.