Skip to content

Conversation

@Xingfu-Yi
Copy link

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 image was implicitly assumed to exist even when latents and masked_image_latents were directly provided as inputs.

When both latents and masked_image_latents are passed, supplying an image is not only unnecessary but also disallowed by input validation. However, the current implementation still tries to preprocess image, which results in a NoneType error when image is None.

This PR adds a minimal and safe fix:
If image is None, the code now explicitly sets init_image = None and skips unnecessary preprocessing. This ensures that downstream logic, such as self.prepare_latents(), correctly bypasses latent initialization and uses the user-provided latents as intended.

Changes

  • Added a conditional check to skip image preprocessing when image is None
  • Prevents runtime errors when using latent-only initialization
  • Maintains compatibility and minimal code change within the existing pipeline logic

Why is this important?

Without this fix, initializing the Flux Fill pipeline with precomputed latents is impossible due to a NoneType dereference during image preprocessing.
This breaks valid workflows that rely on directly supplying latents and masked_image_latents (for example, when reusing intermediate latent states for iterative or compositional generation).

Fixes

Fixes # (issue number if applicable)

Before submitting

…s are provided

Fix a bug in the Flux Fill pipeline where \`image\` was implicitly required even when
\`latents\` and \`masked_image_latents\` were directly passed.

When both \`latents\` and \`masked_image_latents\` are given, preprocessing the \`image\`
is unnecessary. The previous implementation assumed \`image\` was always provided,
causing errors or redundant preprocessing.

Changes:
- Added conditional check to skip image preprocessing when \`image\` is None
- Allows \`latents\`-only inputs to run successfully
- Improves consistency with other pipelines
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

Successfully merging this pull request may close these issues.

1 participant