huggingface / huggingface/diffusers

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

Abierto Apto para principiantes
#14,057 1 comentario 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
Python
Estrellas
34.5k
Forks
7.3k
Merge medio
3 d 3 h
PR fusionados (30 d)
91

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con las definiciones y llamadas de check_inputs en pipeline_controlnet_img2img y pipeline_controlnet_inpaint. Compara la validación de múltiples ControlNet con pipeline_controlnet y verifica después que ambas pipelines validen control_image de forma coherente y que las pruebas existentes de las pipelines pasen; se considera terminado cuando las comprobaciones ya no inspeccionen la imagen dos veces.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python, pytorch
Área
machine-learning
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Tranquilo
Claridad
Bien especificado
Aptitud para principiantes
70/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.