-
Notifications
You must be signed in to change notification settings - Fork 6.1k
update: FluxKontextInpaintPipeline support #11820
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
base: main
Are you sure you want to change the base?
Conversation
Awesome. 👍 |
Fantastic! Would be cool to have a demo for it on Hugging Face Spaces while the PR gets reviewed :-) |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the super cool PR! I left some comments
would you be able to provide more results for different strength values for both with and without the image_reference?
image: Optional[PipelineImageInput] = None, | ||
image_reference: Optional[PipelineImageInput] = None, | ||
mask_image: PipelineImageInput = None, | ||
masked_image_latents: PipelineImageInput = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's not support masked_image_latents
for now so that we can simplify the logic a bit here - it's not used here
else: | ||
masked_image = masked_image_latents | ||
|
||
mask, masked_image_latents = self.prepare_mask_latents( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see masked_image_latents being used in this pipeline, let's remove logics that we don't need here
self._interrupt = False | ||
|
||
# 2. Preprocess image | ||
if image is not None and not (isinstance(image, torch.Tensor) and image.size(1) == self.latent_channels): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think image
is not optional for this pipeline, no?
Hi @yiyixuxu, I just updated the code based on your comments — thank you so much! About updating the results with more Inpainting with text onlyInpainting with image conditioningIt seems that |
While waiting for the PR to be reviewed, feel free to test it using: |
Thanks again @vuongminh1907 Tested using Working good with nunchaku optimization. Will do more tests. Kindly review and merge. Nunchaku output |
🚀 What does this PR do?
Hello! 👋 I'm truly impressed with Flux Kontext, but I noticed that inpainting functionality hasn’t been fully integrated yet. This PR adds support for inpainting using the 🤗 Diffusers library.
This contribution introduces:
🎯 Inpainting with text only
✅ Result using FluxKontextInpaintPipeline:

🧩 Inpainting with image conditioning
📥 Input image, mask, and reference image:



🎉 Output using FluxKontextInpaintPipeline:

I hope this PR will be helpful for the community and contribute positively to the Diffusers ecosystem! 🌱
Core library: