这是 Qwen-Image-2.1 的 FP8 / INT8 量化版本,并附带其 Qwen3-VL 文本编码器的预转换 FP8 副本。
| 文件 | 大小 | 替代 |
|---|---|---|
Qwen-Image-2.1-INT8.safetensors | 7.26 GB | 14.23 GB bf16 transformer |
Qwen-Image-2.1-FP8.safetensors | 7.12 GB | 14.23 GB bf16 transformer |
Qwen-Image-2.1-text_encoder-FP8.safetensors | 9.39 GB | 17.5 GB bf16 text_encoder |
vae/qwen_image_2.1_vae_bf16.safetensors | 0.63 GB | fp32 vae,用于 unsloth/Qwen-Image-2.1-GGUF |
这里所有内容均为 safetensors 而非 pickle,因此加载时不会执行任意代码。需要 diffusers 的 main 分支构建版本:Qwen-Image-2.1 支持是在 0.40 版本之后加入的。
| INT8 | INT8 |
![]() | ![]() |
| FP8 | FP8 |
![]() | ![]() |
🤖 ModelScope | 🤗 HuggingFace | 📑 博客 | 🖥️ 演示 | 🫨 Discord | 💬 WeChat
我们很高兴开源 Qwen-Image-2.1,这是 Qwen 家族中统一的文生图与图像编辑模型。其视觉生成组件仅具有 7B 参数(32 个 Single-Stream DiT 层),即可在生成质量、推理效率和通用性之间取得平衡。
本次发布带来四项核心改进:
pip install torch>=2.4.0
pip install transformers>=5.17
pip install git+https://github.com/huggingface/diffusers
pip install accelerate pillowimport torch
from diffusers import QwenImage21Pipeline
pipe = QwenImage21Pipeline.from_pretrained(
"Qwen/Qwen-Image-2.1", torch_dtype=torch.bfloat16
).to("cuda")
image = pipe(
prompt="A neon shop sign that reads \"QWEN IMAGE 2.1\", rainy night, reflections on wet pavement",
width=2048, height=2048,
num_inference_steps=40,
generator=torch.Generator("cuda").manual_seed(42),
).images[0]
image.save("t2i_example.png")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="Change the background to a sunset beach",
image=input_image,
num_inference_steps=40,
generator=torch.Generator("cuda").manual_seed(42),
).images[0]
image.save("edit_example.png")请使用透明图像的推荐提示词格式:
image = pipe(
prompt="This is an RGBA image with transparency. A cute cartoon dragon sticker. The image has alpha channel and the background is transparent.",
width=2048, height=2048,
num_inference_steps=40,
generator=torch.Generator("cuda").manual_seed(42),
).images[0]
image.save("transparent_example.png")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),
}pipe = QwenImage21Pipeline.from_pretrained(
"Qwen/Qwen-Image-2.1", torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()
原生透明图像生成
基于六张人像参考生成的合影
文本渲染
该模型基于 Qwen Research License Agreement 授权。