huggingface / huggingface/diffusers

SD1.5 - pipeline_controlnet_img2img and pipeline_controlnet_inpaint are mixing variables "image" and "control_image"

Aperta Adatta ai principianti
#14,057 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Python
Stelle
34.5k
Fork
7.3k
Merge medio
3g 3h
PR unite (30g)
91

Descrizione

### Describe the bug

"image" is used in pipeline_controlnet for a list of controlnet images.
"control_image" is used in pipeline_controlnet_img2img and pipeline_controlnet_inpaint for a list of controlnet images.
img2img and inpaint are missing "control_image" in check_inputs function causing an error

The img2img and inpaint check_inputs function is checking against "image" twice instead of "image" and "control_image".
this section from both files is for the "control_image" list but is checking against "image"

if not isinstance(image, list):
raise TypeError("For multiple controlnets: `image` must be type `list`")

# When `image` is a nested list:
# (e.g. [[canny_image_1, pose_image_1], [canny_image_2, pose_image_2]])
elif any(isinstance(i, list) for i in image):
raise ValueError("A single batch of multiple conditionings are supported at the moment.")
elif len(image) != len(self.controlnet.nets):
raise ValueError(
f"For multiple controlnets: `image` must have the same length as the number of controlnets, but got {len(image)} images and {len(self.controlnet.nets)} ControlNets."
)

for image_ in image:
self.check_image(image_, prompt, prompt_embeds)
###
quick fix - add "control_image" to def check_inputs and self.check_inputs and replace the above with the following
###
if not isinstance(control_image, list):
raise TypeError("For multiple controlnets: `control_image` must be type `list`")

# When `control_image` is a nested list:
# (e.g. [[canny_image_1, pose_image_1], [canny_image_2, pose_image_2]])
elif any(isinstance(i, list) for i in control_image):
raise ValueError("A single batch of multiple conditionings are supported at the moment.")
elif len(control_image) != len(self.controlnet.nets):
raise ValueError(
f"For multiple controlnets: `control_image` must have the same length as the number of controlnets, but got {len(control_image)} images and {len(self.controlnet.nets)} ControlNets."
)

for image_ in control_image:
self.check_image(image_, prompt, prompt_embeds)

@yiyixuxu @asomoza @DN6 @sayakpaul

### Reproduction

no reproducible code

### Logs

```shell

```

### System Info

- 🤗 Diffusers version: 0.37.1
- Platform: Windows-10-10.0.19045-SP0
- Running on Google Colab?: No
- Python version: 3.10.6
- PyTorch version (GPU?): 2.12.1+cpu (False)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Huggingface_hub version: 1.9.1
- Transformers version: 5.5.0
- Accelerate version: 1.12.0
- PEFT version: 0.18.1
- Bitsandbytes version: not installed
- Safetensors version: 0.8.0

### Who can help?

_No response_

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with the check_inputs definitions and calls in pipeline_controlnet_img2img and pipeline_controlnet_inpaint. Compare the multiple-ControlNet validation with pipeline_controlnet, then verify that both pipelines validate control_image consistently and that the existing pipeline tests pass; done means the checks no longer inspect image twice.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python, pytorch
Ambito
machine-learning
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Tranquilla
Chiarezza
Specificata chiaramente
Idoneità per principianti
70/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.