huggingface / huggingface/diffusers
FluxControlNetImg2ImgPipeline doesn't support generating more than one image
- Vorherrschende Sprache
- Python
- Sterne
- 34.5k
- Forks
- 7.3k
- Ø Merge
- 3 T. 3 Std.
- Gemergte PRs (30 T.)
- 91
Beschreibung
### 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
Beitragsleitfaden
Rechercherichtung
Beginne in pipeline_flux_controlnet_image_to_image.py ungefähr bei Zeile 818 und reproduziere den Fehler mit FluxControlNetImg2ImgPipeline unter Verwendung von num_images_per_prompt=2. Überprüfe die Behandlung von control_mode und stelle sicher, dass das Generieren von mehr als einem Bild nicht mehr den gemeldeten RuntimeError aufgrund einer Tensorgrößenabweichung auslöst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python, pytorch
- Bereich
- machine-learning
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 48/100