DiffSynth-Studio icon indicating copy to clipboard operation
DiffSynth-Studio copied to clipboard

Qwen-Image-Edit-2509

Open Amark-cheey opened this issue 2 months ago • 2 comments

examples/qwen_image/model_inference/Qwen-Image-Edit-2509.py

from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig from PIL import Image import torch

pipe = QwenImagePipeline.from_pretrained( torch_dtype=torch.bfloat16, device="cuda", model_configs=[ ModelConfig(model_id="Qwen/Qwen-Image-Edit-2509", origin_file_pattern="transformer/diffusion_pytorch_model*.safetensors"), ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="text_encoder/model*.safetensors"), ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="vae/diffusion_pytorch_model.safetensors"), ], processor_config=ModelConfig(model_id="Qwen/Qwen-Image-Edit", origin_file_pattern="processor/"), )

image_1 = pipe(prompt="一位少女", seed=0, num_inference_steps=40, height=1328, width=1024) image_1.save("image1.jpg")

image_2 = pipe(prompt="一位老人", seed=0, num_inference_steps=40, height=1328, width=1024) image_2.save("image2.jpg")

prompt = "生成这两个人的合影" edit_image = [Image.open("image1.jpg"), Image.open("image2.jpg")] image_3 = pipe(prompt, edit_image=edit_image, seed=1, num_inference_steps=40, height=1328, width=1024, edit_image_auto_resize=True) image_3.save("image3.jpg")

Traceback (most recent call last): File "/home/hujh/expriement/1-Qwen/DiffSynth-Studio-main/Qwen-Image-edit-plus.py", line 26, in image_3 = pipe( ^^^^^ File "/home/hujh/anaconda3/envs/DiffSynth/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 120, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/hujh/expriement/1-Qwen/DiffSynth-Studio-main/diffsynth/pipelines/qwen_image.py", line 420, in call inputs_shared, inputs_posi, inputs_nega = self.unit_runner(unit, self, inputs_shared, inputs_posi, inputs_nega) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/hujh/expriement/1-Qwen/DiffSynth-Studio-main/diffsynth/utils/init.py", line 273, in call processor_outputs = unit.process(pipe, **processor_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/hujh/expriement/1-Qwen/DiffSynth-Studio-main/diffsynth/pipelines/qwen_image.py", line 712, in process resized_edit_image = self.edit_image_auto_resize(edit_image) if edit_image_auto_resize else edit_image ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/hujh/expriement/1-Qwen/DiffSynth-Studio-main/diffsynth/pipelines/qwen_image.py", line 705, in edit_image_auto_resize calculated_width, calculated_height = self.calculate_dimensions(1024 * 1024, edit_image.size[0] / edit_image.size[1]) ^^^^^^^^^^^^^^^ AttributeError: 'list' object has no attribute 'size'

Amark-cheey avatar Oct 21 '25 07:10 Amark-cheey

@Amark-cheey Please use git clone to download the latest code.

Artiprocher avatar Oct 30 '25 05:10 Artiprocher

@Amark-cheey Please use git clone to download the latest code.

I also face the same question, but I git clone the code just now and the question remained. Could you please tell me why? Thanks.

zyjOrz avatar Nov 26 '25 09:11 zyjOrz