-
Notifications
You must be signed in to change notification settings - Fork 6.1k
[fix] Flux Kontext resize method #11863
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
Hi @asomoza ! |
thanks @Net-Mist the I think the best option here is to refactor the pipeline which is the only case that this happens instead of the Also I don't understand fully why the kontext pipeline uses the |
@@ -523,6 +523,16 @@ def resize( | |||
size=(height, width), | |||
) | |||
image = self.pt_to_numpy(image) | |||
elif isinstance(image, list): |
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 resize
is intended to only accept single image
@a-r-r-o-w any reason we run resize sepereately here? (instead of being part of the preprocess
)?
image = self.image_processor.resize(image, image_height, image_width) |
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 preprocess should be okay. I don't remember why I used resize (maybe I just forgot that preprocess existed when I wrote this code. either way I don't remember the context now, but I'll check original repo again)
What does this PR do?
Hello !
When working on Flux-Kontext, I discovered a silent bug regarding the resizing of the image, when calling the pipeline with several images.
__call__
method of theFluxKontextPipeline
class takes animage
of typeOptional[PipelineImageInput]
. This variable can be a list in case of batch size > 1resize
method of theVaeImageProcessor
class is called (image = self.image_processor.resize(image, image_height, image_width)
). But this method does not support lists as input. Due to the way this method is written (overriding theimage
variable and then returning it), it doesn't resize the image and return it as-is.In this fix, I corrected this by changing a minimal number of lines of code to handle lists. However, please let me know if you'd prefer that I also add additional input checks or safeguards.
Fixes # (issue)
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.