Skip to content

Commit 54ab475

Browse files
authored
Fix Flux Controlnet Pipeline _callback_tensor_inputs Missing Some Elements (huggingface#10974)
* Update pipeline_flux_controlnet.py * Update pipeline_flux_controlnet_image_to_image.py * Update pipeline_flux_controlnet_inpainting.py * Update pipeline_flux_controlnet_inpainting.py * Update pipeline_flux_controlnet_inpainting.py
1 parent f103993 commit 54ab475

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/diffusers/pipelines/flux/pipeline_flux_controlnet.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class FluxControlNetPipeline(DiffusionPipeline, FluxLoraLoaderMixin, FromSingleF
202202

203203
model_cpu_offload_seq = "text_encoder->text_encoder_2->image_encoder->transformer->vae"
204204
_optional_components = ["image_encoder", "feature_extractor"]
205-
_callback_tensor_inputs = ["latents", "prompt_embeds"]
205+
_callback_tensor_inputs = ["latents", "prompt_embeds", "control_image"]
206206

207207
def __init__(
208208
self,
@@ -1149,6 +1149,7 @@ def __call__(
11491149

11501150
latents = callback_outputs.pop("latents", latents)
11511151
prompt_embeds = callback_outputs.pop("prompt_embeds", prompt_embeds)
1152+
control_image = callback_outputs.pop("control_image", control_image)
11521153

11531154
# call the callback, if provided
11541155
if i == len(timesteps) - 1 or ((i + 1) > num_warmup_steps and (i + 1) % self.scheduler.order == 0):

src/diffusers/pipelines/flux/pipeline_flux_controlnet_image_to_image.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class FluxControlNetImg2ImgPipeline(DiffusionPipeline, FluxLoraLoaderMixin, From
198198

199199
model_cpu_offload_seq = "text_encoder->text_encoder_2->transformer->vae"
200200
_optional_components = []
201-
_callback_tensor_inputs = ["latents", "prompt_embeds"]
201+
_callback_tensor_inputs = ["latents", "prompt_embeds", "control_image"]
202202

203203
def __init__(
204204
self,
@@ -973,6 +973,7 @@ def __call__(
973973

974974
latents = callback_outputs.pop("latents", latents)
975975
prompt_embeds = callback_outputs.pop("prompt_embeds", prompt_embeds)
976+
control_image = callback_outputs.pop("control_image", control_image)
976977

977978
if i == len(timesteps) - 1 or ((i + 1) > num_warmup_steps and (i + 1) % self.scheduler.order == 0):
978979
progress_bar.update()

src/diffusers/pipelines/flux/pipeline_flux_controlnet_inpainting.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class FluxControlNetInpaintPipeline(DiffusionPipeline, FluxLoraLoaderMixin, From
200200

201201
model_cpu_offload_seq = "text_encoder->text_encoder_2->transformer->vae"
202202
_optional_components = []
203-
_callback_tensor_inputs = ["latents", "prompt_embeds"]
203+
_callback_tensor_inputs = ["latents", "prompt_embeds", "control_image", "mask", "masked_image_latents"]
204204

205205
def __init__(
206206
self,
@@ -1178,6 +1178,9 @@ def __call__(
11781178

11791179
latents = callback_outputs.pop("latents", latents)
11801180
prompt_embeds = callback_outputs.pop("prompt_embeds", prompt_embeds)
1181+
control_image = callback_outputs.pop("control_image", control_image)
1182+
mask = callback_outputs.pop("mask", mask)
1183+
masked_image_latents = callback_outputs.pop("masked_image_latents", masked_image_latents)
11811184

11821185
if i == len(timesteps) - 1 or ((i + 1) > num_warmup_steps and (i + 1) % self.scheduler.order == 0):
11831186
progress_bar.update()

0 commit comments

Comments
 (0)