huggingface / huggingface/diffusers
FluxControlNetImg2ImgPipeline doesn't support generating more than one image
- Dominant language
- Python
- Stars
- 34.5k
- Forks
- 7.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 91
Description
### 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
Contributor guide
Assessment
This issue has not been assessed yet.