Hardware note: Full open-weight inference needs substantial VRAM (BF16 โ 30 GB+).
Free Static Spaces cannot run the model locally. Use the official API-backed demo above, or run the Diffusers snippets on a GPU machine / paid Space.
Key Features
Compact & Efficient
32 single-stream DiT layers, mixed-granularity attention, prefix KV cache reuse.
Native Transparency
Generate or edit RGBA images; extract subjects from photos in one model.
Versatile Editing
Up to 10 reference images, local edits via masks / annotations, identity preservation.
Refined Aesthetics
Improved typography, portrait lighting, and fine detail quality.
Quick Start (Diffusers)
Installation
pip install torch>=2.4.0
pip install transformers>=5.17
pip install git+https://github.com/huggingface/diffusers
pip install accelerate pillow
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='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")
Image Editing
from PIL import Image
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")
Recommended Settings
- Steps: 40 (default recommendation)
- Guidance: Off by default. Use
true_cfg_scale > 1+ negative prompt to enable CFG (doubles compute). - Resolution: Up to 2048ร2048 (or aspect-ratio presets like 2688ร1536, 1536ร2688, etc.)
- Precision:
torch.bfloat16recommended
Links & Resources
License: Qwen Research License โ non-commercial / research use. Commercial use requires a separate agreement with Alibaba.