Fix: allow Flux Fill pipeline to skip image preprocessing when latents are provided #12627
+5
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: allow Flux Fill pipeline to skip image preprocessing when latents are provided
What does this PR do?
Fixes a critical bug in the Flux Fill pipeline where
imagewas implicitly assumed to exist even whenlatentsandmasked_image_latentswere directly provided as inputs.When both
latentsandmasked_image_latentsare passed, supplying animageis not only unnecessary but also disallowed by input validation. However, the current implementation still tries to preprocessimage, which results in aNoneTypeerror whenimageisNone.This PR adds a minimal and safe fix:
If
imageisNone, the code now explicitly setsinit_image = Noneand skips unnecessary preprocessing. This ensures that downstream logic, such asself.prepare_latents(), correctly bypasses latent initialization and uses the user-provided latents as intended.Changes
imagepreprocessing whenimageisNoneWhy is this important?
Without this fix, initializing the Flux Fill pipeline with precomputed latents is impossible due to a
NoneTypedereference during image preprocessing.This breaks valid workflows that rely on directly supplying
latentsandmasked_image_latents(for example, when reusing intermediate latent states for iterative or compositional generation).Fixes
Fixes # (issue number if applicable)
Before submitting
imageis provided normally.