You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The FluxControlNetImg2ImgPipeline does not support generating more than one image.
The error encountered is: RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 2 but got size 1 for tensor number 1 in the list.
I figured out that the control_mode needs to be sent as a list of control_mode values, matching the requested number of images specified by the num_images_per_prompt parameter.
As I see it, in the file pipeline_flux_controlnet_image_to_image.py, at line 818, the following code needs to be added:
if control_mode is not None:
if batch_size * num_images_per_prompt > 1:
control_mode = [control_mode] * batch_size * num_images_per_prompt
control_mode = torch.tensor(control_mode).to(device, dtype=torch.long)
control_mode = control_mode.reshape([-1, 1])
Does this make sense? Would you like PR on this fix?
Reproduction
FluxControlNetImg2ImgPipeline with num_images_per_prompt=2
liorRabkin
changed the title
FluxControlNetImg2ImgPipeline does not support generating more than one image
FluxControlNetImg2ImgPipeline doesn't support generating more than one image
Feb 6, 2025
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
Describe the bug
The FluxControlNetImg2ImgPipeline does not support generating more than one image.
The error encountered is: RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 2 but got size 1 for tensor number 1 in the list.
I figured out that the control_mode needs to be sent as a list of control_mode values, matching the requested number of images specified by the num_images_per_prompt parameter.
As I see it, in the file pipeline_flux_controlnet_image_to_image.py, at line 818, the following code needs to be added:
if control_mode is not None:
if batch_size * num_images_per_prompt > 1:
control_mode = [control_mode] * batch_size * num_images_per_prompt
control_mode = torch.tensor(control_mode).to(device, dtype=torch.long)
control_mode = control_mode.reshape([-1, 1])
Does this make sense? Would you like PR on this fix?
Reproduction
FluxControlNetImg2ImgPipeline with num_images_per_prompt=2
System Info
diffusers = 0.32.2
Who can help?
@sayakpaul @yiyixuxu
The text was updated successfully, but these errors were encountered: