Skip to content

Commit bff8644

Browse files
committed
Fix for FluxMultiControlNetModel
1 parent b07b48d commit bff8644

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/diffusers/pipelines/flux/pipeline_flux_controlnet.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ def __call__(
780780
elif isinstance(self.controlnet, FluxMultiControlNetModel):
781781
control_images = []
782782

783-
for control_image_ in control_image:
783+
for i, control_image_ in enumerate(control_image):
784784
control_image_ = self.prepare_image(
785785
image=control_image_,
786786
width=width,
@@ -792,19 +792,22 @@ def __call__(
792792
)
793793
height, width = control_image_.shape[-2:]
794794

795-
# vae encode
796-
control_image_ = self.vae.encode(control_image_).latent_dist.sample()
797-
control_image_ = (control_image_ - self.vae.config.shift_factor) * self.vae.config.scaling_factor
798-
799-
# pack
800-
height_control_image, width_control_image = control_image_.shape[2:]
801-
control_image_ = self._pack_latents(
802-
control_image_,
803-
batch_size * num_images_per_prompt,
804-
num_channels_latents,
805-
height_control_image,
806-
width_control_image,
807-
)
795+
if self.controlnet.nets[i].input_hint_block is None:
796+
# vae encode
797+
control_image_ = self.vae.encode(control_image_).latent_dist.sample()
798+
control_image_ = (control_image_ - self.vae.config.shift_factor) * self.vae.config.scaling_factor
799+
800+
# pack
801+
height_control_image, width_control_image = control_image_.shape[2:]
802+
control_image_ = self._pack_latents(
803+
control_image_,
804+
batch_size * num_images_per_prompt,
805+
num_channels_latents,
806+
height_control_image,
807+
width_control_image,
808+
)
809+
else:
810+
controlnet_blocks_repeat = True
808811

809812
control_images.append(control_image_)
810813

0 commit comments

Comments
 (0)