Qwen/Qwen-Image-2.1
摘要
Qwen-Image-2.1是一个开源的统一文本到图像和图像编辑模型,拥有70亿参数,具有高效的架构、透明度支持和多功能的编辑能力。
查看缓存全文
缓存时间: 2026/09/20 14:52
Qwen/Qwen-Image-2.1 · Hugging Face
来源:https://huggingface.co/Qwen/Qwen-Image-2.1
🤖ModelScope (https://modelscope.cn/models/Qwen/Qwen-Image-2.1)| 🤗HuggingFace (https://huggingface.co/Qwen/Qwen-2.1)| 📑博客 (https://qwen.ai/blog?id=qwen-image-2.1)| 🖥️演示 (https://huggingface.co/spaces/Qwen/Qwen-Image-2.1)| 🫨Discord (https://discord.gg/CV4E9rpNSD)
https://huggingface.co/Qwen/Qwen-Image-2.1#introduction简介
我们很高兴地开源 Qwen-Image-2.1,这是 Qwen 家族中统一的文本到图像生成与图像编辑模型。仅凭借其视觉生成组件中的 7B 参数(32 个单流 DiT 层),Qwen-Image-2.1 兼顾了生成质量、推理效率和多功能性。
本次发布包含四项关键改进:
- 紧凑高效——通过混合粒度注意力机制和前缀 KV 缓存复用,在低计算成本下实现了出色的图像质量。
- 原生透明度,统一创作与编辑——可从文本生成常规或透明(RGBA)图像,编辑透明图层,以及从照片中提取主体,所有功能集于一体。
- 多功能编辑——支持最多 10 张参考图像,可通过圆圈、手绘标注或独立蒙版指定局部编辑,并能保持人物与产品的一致性。
- 逼真纹理与精美美学——改进了排版、人像光照和细节处理,使视觉效果更具吸引力。
更多详情请参阅 GitHub 仓库 (https://github.com/QwenLM/Qwen-Image-2.1) 和博客 (https://qwen.ai/blog?id=qwen-image-2.1)。
https://huggingface.co/Qwen/Qwen-Image-2.1#quick-start快速开始
https://huggingface.co/Qwen/Qwen-Image-2.1#installation安装
pip install torch>=2.4.0 pip install transformers>=5.17 pip install git+https://github.com/huggingface/diffusers pip install accelerate pillow
https://huggingface.co/Qwen/Qwen-Image-2.1#text-to-image文生图
`` import torch from diffusers import QwenImage21Pipeline
pipe = QwenImage21Pipeline.from_pretrained( “Qwen/Qwen-Image-2.1”, torch_dtype=torch.bfloat16 ).to(“cuda”)
image = pipe( prompt=“一个写着“QWEN IMAGE 2.1”的霓虹商店招牌,雨夜,潮湿路面上的倒影”, width=2048, height=2048, num_inference_steps=40, generator=torch.Generator(“cuda”).manual_seed(42), ).images[0]
image.save(“t2i_example.png”) ``
https://huggingface.co/Qwen/Qwen-Image-2.1#image-editing图像编辑
`` import torch from PIL import Image from diffusers import QwenImage21Pipeline
pipe = QwenImage21Pipeline.from_pretrained( “Qwen/Qwen-Image-2.1”, torch_dtype=torch.bfloat16 ).to(“cuda”)
input_image = Image.open(“input.png”)
image = pipe( prompt=“将背景改为日落海滩”, image=input_image, num_inference_steps=40, generator=torch.Generator(“cuda”).manual_seed(42), ).images[0]
image.save(“edit_example.png”) ``
https://huggingface.co/Qwen/Qwen-Image-2.1#transparent-image-generation-rgba透明图像生成(RGBA)
使用推荐的提示格式生成透明图像:
`` image = pipe( prompt=“这是一张具有透明度的RGBA图像。一个可爱的卡通龙贴纸。图像具有Alpha通道,背景透明。”, width=2048, height=2048, num_inference_steps=40, generator=torch.Generator(“cuda”).manual_seed(42), ).images[0]
image.save(“transparent_example.png”) ``
https://huggingface.co/Qwen/Qwen-Image-2.1#supported-aspect-ratios支持的纵横比
aspect_ratios = { "1:1": (2048, 2048), "4:3": (2400, 1792), "3:4": (1792, 2400), "3:2": (2528, 1696), "2:3": (1696, 2528), "16:9": (2752, 1536), "9:16": (1536, 2752), }
https://huggingface.co/Qwen/Qwen-Image-2.1#memory-optimization内存优化
pipe = QwenImage21Pipeline.from_pretrained( "Qwen/Qwen-Image-2.1", torch_dtype=torch.bfloat16 ) pipe.enable_model_cpu_offload()
https://huggingface.co/Qwen/Qwen-Image-2.1#showcase示例展示
原生透明图像生成
基于六张肖像参考生成的群像
文本渲染
https://huggingface.co/Qwen/Qwen-Image-2.1#license许可证
本模型采用 Qwen 研究许可协议 (https://huggingface.co/Qwen/Qwen-Image-2.1/tree/main/LICENSE) 授权。
相似文章
Qwen-Image-2.0 技术报告
Qwen-Image-2.0 是一个全新的图像生成基础模型,基于 Qwen3-VL 和多模态扩散 Transformer,将高保真合成与精确编辑能力统一起来。它在富含文本的内容、多语言排版以及照片级真实感生成方面表现卓越。
Qwen-Image-2.1:紧凑、高效且统一的图像生成
Qwen-Image-2.1是一款紧凑高效的AI模型,专为统一图像生成而设计,由阿里巴巴打造,旨在提升图像生成任务的性能和可用性。
unsloth/Qwen-Image-2.1-GGUF
Qwen-Image-2.1 是一个统一的文本到图像生成和图像编辑模型,拥有70亿参数,在效率、透明度、多功能性和真实性方面有所改进。来自 unsloth 的这个 GGUF 量化版本支持高效的本地推理。
Qwen 3.0 Image Pro
QwenCloud 发布了 Qwen-Image-3.0-Pro,一款强大的图像生成模型,支持密集布局、微小文字渲染和原生多语言输出,将其定位为可部署的生产力工具。
Comfy-Org/Qwen-Image-2.1
为 ComfyUI 工作流程优化的 Qwen-Image-2.1 重打包模型文件,支持文本生成图像和图像编辑功能。