From 94979336863a0b7973bcafa4f7e7adec33862e83 Mon Sep 17 00:00:00 2001 From: Xingfu Yi <54938415+Xingfu-Yi@users.noreply.github.com> Date: Tue, 11 Nov 2025 02:09:03 +0000 Subject: [PATCH] Fix: allow Flux Fill pipeline to skip image preprocessing when latents 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 --- src/diffusers/pipelines/flux/pipeline_flux_fill.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/diffusers/pipelines/flux/pipeline_flux_fill.py b/src/diffusers/pipelines/flux/pipeline_flux_fill.py index 5cb9c82204b2..2008066793a9 100644 --- a/src/diffusers/pipelines/flux/pipeline_flux_fill.py +++ b/src/diffusers/pipelines/flux/pipeline_flux_fill.py @@ -890,8 +890,11 @@ def __call__( self._joint_attention_kwargs = joint_attention_kwargs self._interrupt = False - init_image = self.image_processor.preprocess(image, height=height, width=width) - init_image = init_image.to(dtype=torch.float32) + if image: + init_image = self.image_processor.preprocess(image, height=height, width=width) + init_image = init_image.to(dtype=torch.float32) + else: + init_image = None # 2. Define call parameters if prompt is not None and isinstance(prompt, str):