modelscope / modelscope/DiffSynth-Studio
Qwen-Image-Edit-2509
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.1k
- Forks
- 1.3k
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 45
Description
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'
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with examples/qwen_image/model_inference/Qwen-Image-Edit-2509.py and reproduce the failure using diffsynth/pipelines/qwen_image.py. Read the process method and edit_image_auto_resize around the traceback to understand the expected edit_image shape. Done means the two-image example runs past the resize step without the reported AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- computer-vision, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100