Qwen Image Edit 2509

提供商Qwen
分类image-to-image
许可证apache-2.0
下载量501.8K
星标246

简介

Qwen Image Edit 2509 是阿里通义千问团队推出的图像编辑模型,主打精准的指令驱动修改。与传统的 AI 绘图不同,它更像是一个懂指令的“智能修图师”,用户无需复杂的 Prompt 工程,直接用自然语言描述修改需求(如“把背景换成海滩”或“给人物加一副眼镜”),模型即可在保持原图主体一致性的前提下完成局部调整。对于开发者而言,其 Apache-2.0 协议极大降低了商用门槛,非常适合集成到电商修图、社交 App 滤镜或自动化设计工作流中,上手难度极低。

核心亮点

  • 自然语言驱动,无需复杂 Prompt 即可精准修图
  • 极强的主体一致性,有效避免修改后原图走样
  • Apache-2.0 开源协议,商业集成灵活且成本低
  • 适配多种图像编辑场景,提升设计工作流效率

使用方法

安装依赖
# 安装 Hugging Face transformers
pip install transformers torch
SDK 使用
# 使用 transformers 加载模型
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("Qwen/Qwen-Image-Edit-2509")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen-Image-Edit-2509")

Hugging Face 下载

我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 huggingface_hub:

操作指引
pip install -U huggingface_hub

命令行下载

下载完整模型库

下载完整模型库
huggingface-cli download Qwen/Qwen-Image-Edit-2509

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download Qwen/Qwen-Image-Edit-2509 config.json --local-dir ./dir

更多命令行下载选项,可参见官方文档

SDK 下载

SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('Qwen/Qwen-Image-Edit-2509')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://huggingface.co/Qwen/Qwen-Image-Edit-2509

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/Qwen/Qwen-Image-Edit-2509

模型文件托管在 Hugging Face Hub,使用 HF CLI / SDK / Git 直接下载,不经过本站。

PyTorch / Transformers 使用

安装 Transformers

安装 Transformers
pip install -U transformers torch

模型加载和推理

模型加载和推理
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('Qwen/Qwen-Image-Edit-2509')
tokenizer = AutoTokenizer.from_pretrained('Qwen/Qwen-Image-Edit-2509')

模型下载

我们推荐使用命令行或者 ModelScope SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 ModelScope:

操作指引
pip install modelscope

命令行下载

下载完整模型库

下载完整模型库
modelscope download --model Qwen/Qwen-Image-Edit-2509

下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)

下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)
modelscope download --model Qwen/Qwen-Image-Edit-2509 README.md --local_dir ./dir

更多更丰富的命令行下载选项,可参见具体文档

SDK 下载

SDK 下载
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('Qwen/Qwen-Image-Edit-2509')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://www.modelscope.cn/Qwen/Qwen-Image-Edit-2509.git

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/Qwen/Qwen-Image-Edit-2509.git

ModelScope 模型页直接下载模型文件;无需将模型文件放在本站服务器。

Notebook 快速开发

下载并安装 ModelScope library

下载并安装 ModelScope library
pip install "modelscope[audio,cv,nlp,multi-modal,science]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

模型加载和推理

模型加载和推理
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = pipeline('text-generation', 'Qwen/Qwen-Image-Edit-2509')

完整文档

来源: HuggingFace

---
license: apache-2.0
language:

  • en

  • zh

library_name: diffusers
pipeline_tag: image-to-image
---
<p align="center">
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/qwen_image_edit_logo.png" width="400"/>
<p>
<p align="center">
💜 <a href="https://chat.qwen.ai/"><b>Qwen Chat</b></a>&nbsp&nbsp | &nbsp&nbsp🤗 <a href="https://huggingface.co/Qwen/Qwen-Image-Edit-2509">Hugging Face</a>&nbsp&nbsp | &nbsp&nbsp🤖 <a href="https://modelscope.cn/models/Qwen/Qwen-Image-Edit-2509">ModelScope</a>&nbsp&nbsp | &nbsp&nbsp 📑 <a href="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/Qwen_Image.pdf">Tech Report</a> &nbsp&nbsp | &nbsp&nbsp 📑 <a href="https://qwenlm.github.io/blog/qwen-image-edit/">Blog</a> &nbsp&nbsp
<br>
🖥️ <a href="https://huggingface.co/spaces/Qwen/Qwen-Image-Edit">Demo</a>&nbsp&nbsp | &nbsp&nbsp💬 <a href="https://github.com/QwenLM/Qwen-Image/blob/main/assets/wechat.png">WeChat (微信)</a>&nbsp&nbsp | &nbsp&nbsp🫨 <a href="https://discord.gg/CV4E9rpNSD">Discord</a>&nbsp&nbsp| &nbsp&nbsp <a href="https://github.com/QwenLM/Qwen-Image">Github</a>&nbsp&nbsp
</p>

<p align="center">
<img src="https://qianwen-res.oss-accelerate-overseas.aliyuncs.com/Qwen-Image/edit2509/edit2509_top.jpg" width="1600"/>
<p>

Introduction

This September, we are pleased to introduce Qwen-Image-Edit-2509, the monthly iteration of Qwen-Image-Edit. To experience the latest model, please visit Qwen Chat and select the "Image Editing" feature. Compared with Qwen-Image-Edit released in August, the main improvements of Qwen-Image-Edit-2509 include:
  • Multi-image Editing Support: For multi-image inputs, Qwen-Image-Edit-2509 builds upon the Qwen-Image-Edit architecture and is further trained via image concatenation to enable multi-image editing. It supports various combinations such as "person + person," "person + product," and "person + scene." Optimal performance is currently achieved with 1 to 3 input images.
  • Enhanced Single-image Consistency: For single-image inputs, Qwen-Image-Edit-2509 significantly improves editing consistency, specifically in the following areas:
- Improved Person Editing Consistency: Better preservation of facial identity, supporting various portrait styles and pose transformations; - Improved Product Editing Consistency: Better preservation of product identity, supporting product poster editing; - Improved Text Editing Consistency: In addition to modifying text content, it also supports editing text fonts, colors, and materials;
  • Native Support for ControlNet: Including depth maps, edge maps, keypoint maps, and more.

Quick Start

Install the latest version of diffusers

code
pip install git+https://github.com/huggingface/diffusers

The following contains a code snippet illustrating how to use Qwen-Image-Edit-2509:

python
import os
import torch
from PIL import Image
from diffusers import QwenImageEditPlusPipeline

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 = Image.open("input1.png")
image2 = Image.open("input2.png")
prompt = "The magician bear is on the left, the alchemist bear is on the right, facing each other in the central park square."
inputs = {
"image": [image1, image2],
"prompt": prompt,
"generator": torch.manual_seed(0),
"true_cfg_scale": 4.0,
"negative_prompt": " ",
"num_inference_steps": 40,
"guidance_scale": 1.0,
"num_images_per_prompt": 1,
}
with torch.inference_mode():
output = pipeline(inputs)
output_image = output.images[0]
output_image.save("output_image_edit_plus.png")
print("image saved at", os.path.abspath("output_image_edit_plus.png"))

Showcase

The primary update in Qwen-Image-Edit-2509 is support for multi-image inputs.

Let’s first look at a "person + person" example:
!Person + Person Example

Here is a "person + scene" example:
!Person + Scene Example

Below is a "person + object" example:
!Person + Object Example

In fact, multi-image input also supports commonly used ControlNet keypoint maps—for example, changing a person’s pose:
!ControlNet Keypoint Example

Similarly, the following examples demonstrate results using three input images:
!Three Images Example 1
!Three Images Example 2
!Three Images Example 3

---

Another major update in Qwen-Image-Edit-2509 is enhanced consistency.**

First, regarding person consistency, Qwen-Image-Edit-2509 shows significant improvement over Qwen-Image-Edit. Below are examples generating various portrait styles:
!Portrait Styles Example

For instance, changing a person’s pose while maintaining excellent identity consistency:
!Pose Change with Identity Consistency

Leveraging this improvement along with Qwen-Image’s unique text rendering capability, we find that Qwen-Image-Edit-2509 excels at creating meme images:
!Meme Image Example

Of course, even with longer text, Qwen-Image-Edit-2509 can still render it while preserving the person’s identity:
!Long Text with Identity Preservation

Person consistency is also evident in old photo restoration. Below are two examples:
!Old Photo Restoration 1
!Old Photo Restoration 2

Naturally, besides real people, generating cartoon characters and cultural creations is also possible:
!Cartoon & Cultural Creation

Second, Qwen-Image-Edit-2509 specifically enhances product consistency. We find that the model can naturally generate product posters from plain-background product images:
!Product Poster Example

Or even simple logos:
!Logo Generation Example

Third, Qwen-Image-Edit-2509 specifically enhances text consistency and supports editing font type, font color, and font material:
!Text Font Type
!Text Font Color
![Text Font Material](https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/edit2509/%