Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Flux Fill Support #34

Open
chuck-ma opened this issue Nov 22, 2024 · 2 comments
Open

New Flux Fill Support #34

chuck-ma opened this issue Nov 22, 2024 · 2 comments

Comments

@chuck-ma
Copy link

huggingface/diffusers#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
Copy link
Collaborator

lmxyy commented Nov 24, 2024

Looking at it now.

@chuck-ma
Copy link
Author

chuck-ma commented Nov 26, 2024

It seems that if you want to support formats like diffusers, you need to use deepcompressor to perform smooth Quantization on this part of the transformer model. However, due to different control conditions, the previous code designed for generate image condioned by prompt cannot be reused, so we need to modify the code of deepcompressor to support flux fill? What are your specific plans? Is there anything I can do to help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants