huggingface / huggingface/diffusers

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

Offen Anfängerfreundlich
#14,057 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Python
Sterne
34.5k
Forks
7.3k
Ø Merge
3 T. 3 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### 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_

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

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.

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
Ruhig
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
70/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.