`ZImageImg2ImgPipeline` / `ZImageInpaintPipeline`: explicit height/width different from the input image raises RuntimeError
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 70/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- machine-learning
Línea de trabajo
Lee src/diffusers/pipelines/z_image/pipeline_z_image_img2img.py cerca del preprocesamiento de la imagen inicial en la línea 489 y del código de inpainting correspondiente cerca de la línea 673. Compara cómo SD3, Flux, QwenImage y Chroma pasan las dimensiones a image_processor.preprocess; reproduce el problema con una imagen de entrada y distintos valores de height/width. Se considera terminado cuando ambas pipelines acepten las dimensiones de salida solicitadas sin que haya una discrepancia de tamaño.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
In ZImageImg2ImgPipeline and ZImageInpaintPipeline, passing height/width that differ from the input image size raises a size-mismatch RuntimeError, although the docstring says they set the output size. The init image is preprocessed without them (img2img L489, inpaint L673), so it is never resized and keeps its original size, while the noise shape uses height/width. Other pipelines that take height/width (SD3, Flux, QwenImage, Chroma) pass them to image_processor.preprocess, which resizes the image first. In the inpaint pipeline the mask is already resized this way, only the image is not.
Also, passing more images than prompts (e.g. two images with one prompt string) fails with a bare AssertionError in the transformer; a clear ValueError might help.
I'm not sure whether this is intended behavior of the pipeline or an actual bug. If it is a bug, I'd be happy to open a PR that passes height/width to preprocess (and adds the ValueError above, if wanted). Would that be appropriate?
Reproduction
import torch
from PIL import Image
from diffusers import ZImageImg2ImgPipeline
pipe = ZImageImg2ImgPipeline.from_pretrained(
"Tongyi-MAI/Z-Image-Turbo", torch_dtype=torch.bfloat16
).to("cuda")
img = Image.new("RGB", (256, 256))
# Works without height/width (output 256x256).
# With height/width != image size it raises:
# RuntimeError: The size of tensor a (16) must match the size of tensor b (32)
pipe("a cat", image=img, height=128, width=128,
num_inference_steps=4, strength=0.6, guidance_scale=0.0)
Context
I'm building an app that runs image-to-image and inpainting on user images of various sizes, with a target output size chosen by the user. SD3 / SD3 Inpaint and Flux Img2Img / Inpaint work fine with explicit height/width, but Z-Image Img2Img / Inpaint raise the error above.
Logs
File ".../pipeline_z_image_img2img.py", line 345, in prepare_latents
latents = self.scheduler.scale_noise(image_latents, timestep, noise)
File ".../scheduling_flow_match_euler_discrete.py", line 234, in scale_noise
sample = sigma * noise + (1.0 - sigma) * sample
RuntimeError: The size of tensor a (16) must match the size of tensor b (32) at non-singleton dimension 3
System Info
- 🤗 Diffusers version: 0.44.0.dev0
- Platform: Linux-7.0.0-38-generic-x86_64-with-glibc2.39
- Running on Google Colab?: No
- Python version: 3.12.3
- PyTorch version (GPU?): 2.16.0a0+rocm10.3.0a20261117 (True)
- Huggingface_hub version: 2.4.0
- Transformers version: 5.23.0
- Accelerate version: 1.16.0
- PEFT version: not installed
- Safetensors version: 0.8.0
- xFormers version: not installed
- Accelerator: NA
- Using GPU in script?: Yes (AMD Radeon AI PRO R9700)
- Using distributed or parallel set-up in script?: No
diffusers main @ e84bda1
Who can help?
@yiyixuxu @sayakpaul
- Lenguaje dominante
- Python
- Estrellas
- 34.9k
- Forks
- 7.5k
- Merge medio
- 3 d 16 h
- PR fusionados (30 d)
- 65
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de huggingface/diffusers
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
huggingface/diffusers#15363 ·
Los mantenedores suelen responder en 1 día
-
Multi-vector textual inversion uses only the first vector when the token has uppercase letters (transformers v5)Posiblemente ocupada @sunhouy la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
huggingface/diffusers#15313 ·
Los mantenedores suelen responder en 1 día
-
TCDScheduler advances the generator on the final step of a strength-truncated custom schedulePosiblemente ocupada @SIDDARTHAREDDY8 la tomó hace 5 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
huggingface/diffusers#15288 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
unload_textual_inversion(token) leaves the extra tokens of a multi-vector embedding behind, so it can't be loaded againPosiblemente ocupada @sohailshk la tomó hace 11 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
huggingface/diffusers#15211 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
set_ip_adapter_scale(float) raises "Cannot assign 1 scale_configs to 2 IP-Adapter" when several IP-Adapters are loadedPosiblemente ocupada @sohailshk la tomó hace 11 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
huggingface/diffusers#15210 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de huggingface/diffusers
Issues similares
-
[dbt] exported dataset keys reference physical columnsPosiblemente ocupada @WilliamKelley la tomó hoy. Abiertoneeds-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/ossie-converters#251 ·
Los mantenedores suelen responder en 2 días
-
cli difficulty: easy enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
desec-io/desec-stack#1312 ·
Los mantenedores suelen responder en 14 días
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
aws/aws-durable-execution-sdk-python#977 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
flashinfer-ai/flashinfer#9803 ·
Los mantenedores suelen responder en 1 día