Skip to content

[Qwen-image-edit] Batch Inference Issue #12458

@Django-Jiang

Description

@Django-Jiang

Describe the bug

I am trying to run the batch inference for 'Qwen-Image-Edit-2509', but it will raise inference error

AttributeError                            Traceback (most recent call last)
.venv/lib/python3.10/site-packages/diffusers/pipelines/qwenimage/pipeline_qwenimage_edit_plus.py:633) height = height or calculated_height

AttributeError: 'tuple' object has no attribute 'size'

Reproduction

import os
import torch
from PIL import Image
from diffusers import QwenImageEditPlusPipeline
from diffusers.utils import load_image

pipeline = QwenImageEditPlusPipeline.from_pretrained("Qwen/Qwen-Image-Edit-2509", torch_dtype=torch.bfloat16)
print("pipeline loaded")

pipeline.to('cuda')
pipeline.set_progress_bar_config(disable=None)
image1 = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/inpaint.png"),
image2 = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png"),
prompts = [
    "cinematic photo of a beautiful sunset over mountains, 35mm photograph, film, professional, 4k, highly detailed",
    "cinematic film still of a cat basking in the sun on a roof in Turkey, highly detailed, high budget hollywood movie, cinemascope, moody, epic, gorgeous, film grain",
]

with torch.inference_mode():
    output = pipeline(
        image=[image1, image2],
        prompt=prompts,
        generator=[torch.manual_seed(0), torch.manual_seed(0)],
        true_cfg_scale=4.0,
        negative_prompt=" ",
        num_inference_steps=40,
        guidance_scale=1.0,
    )
    output_image = output.images

Logs

System Info

  • 🤗 Diffusers version: 0.36.0.dev0
  • Platform: Linux-6.8.0-63-generic-x86_64-with-glibc2.39
  • Running on Google Colab?: No
  • Python version: 3.10.18
  • PyTorch version (GPU?): 2.8.0+cu128 (True)
  • Flax version (CPU?/GPU?/TPU?): not installed (NA)
  • Jax version: not installed
  • JaxLib version: not installed
  • Huggingface_hub version: 0.35.3
  • Transformers version: 4.57.0
  • Accelerate version: 1.10.1
  • PEFT version: not installed
  • Bitsandbytes version: not installed
  • Safetensors version: 0.6.2
  • xFormers version: not installed
  • Accelerator: NVIDIA H100 NVL, 95830 MiB
    NVIDIA H100 NVL, 95830 MiB
    NVIDIA H100 NVL, 95830 MiB
    NVIDIA H100 NVL, 95830 MiB
    NVIDIA H100 NVL, 95830 MiB
    NVIDIA H100 NVL, 95830 MiB
    NVIDIA H100 NVL, 95830 MiB
    NVIDIA H100 NVL, 95830 MiB

Who can help?

@naykun

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions