Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FluxControlNetImg2ImgPipeline doesn't support generating more than one image #10741

Open
liorRabkin opened this issue Feb 6, 2025 · 1 comment
Labels
bug Something isn't working stale Issues that haven't received updates

Comments

@liorRabkin
Copy link

liorRabkin commented Feb 6, 2025

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

@liorRabkin liorRabkin added the bug Something isn't working label Feb 6, 2025
@liorRabkin 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
Copy link
Contributor

github-actions bot commented Mar 9, 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.

@github-actions github-actions bot added the stale Issues that haven't received updates label Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale Issues that haven't received updates
Projects
None yet
Development

No branches or pull requests

1 participant