QwenLM/Qwen-Image-2.1
Qwen's most powerful open-source image generation model
Qwen‑Image‑2.1 – A 7 B‑parameter text‑to‑image & editing model
What it does
Qwen‑Image‑2.1 is a diffusion‑based generative model that can create images from a textual prompt, edit existing images, or generate images with a transparent (RGBA) background – all with a single checkpoint. The visual generation core has 7 B parameters (32 DiT layers) and runs efficiently on modern GPUs.
Key capabilities
| Feature | Details |
|---|---|
| Text‑to‑image | Produce 2 K‑resolution images (e.g., 2048×2048) in a variety of aspect ratios. |
| Image editing | Accept up to 10 reference images; edit via prompts, circles, painted strokes, or masks while preserving subject identity. |
| Transparent output | Native RGBA generation; useful for stickers, UI assets, etc. |
| Prompt rewriting | Optional Qwen‑3.5‑VL‑based models expand short prompts into detailed descriptions for higher quality results. |
| Efficiency tricks | Mixed‑granularity attention, prefix KV‑cache reuse, and support for FP8 quantisation, CUDA‑graph decoding, and tensor‑parallel inference via vLLM‑Omni, SGLang, LightX2V. |
How to use it
- Install the required packages (PyTorch ≥ 2.4, Transformers ≥ 5.17, Diffusers, Accelerate, Pillow).
- Load the model with the
QwenImage21Pipelinefrom Hugging Face’s diffusers library:from diffusers import QwenImage21Pipeline pipe = QwenImage21Pipeline.from_pretrained( "Qwen/Qwen-Image-2.1", torch_dtype=torch.bfloat16 ).to("cuda") - Call
pipewith a prompt (and optionally an input image or a list of images). The API mirrors the standard Diffusers pipelines, so existing code for Stable Diffusion works unchanged. - For low‑memory GPUs you can enable CPU off‑loading (
pipe.enable_model_cpu_offload()). - For large‑scale serving, run the model with vLLM‑Omni or SGLang‑Diffusion, which exploit the model’s prefix‑KV cache and provide FP8/TP parallelism.
Ecosystem integration
- Hugging Face / ModelScope – weights and demo spaces are hosted on both platforms.
- ComfyUI – ready‑made workflow JSON files for text‑to‑image and editing.
- Diffusers – Day‑0 support via
QwenImage21Pipeline. - vLLM‑Omni / SGLang / LightX2V – high‑throughput serving and GPU‑optimised inference.
- Prompt‑rewrite models – separate checkpoints (
Qwen‑Image‑2.1‑PE‑T2Iand‑PE‑I2I) that can be run locally or via vLLM to automatically expand prompts and suggest aspect ratios.
Hardware notes
- Works on NVIDIA GPUs (CUDA) and, with ROCm, on AMD Radeon GPUs.
- Supports FP8 quantisation and tensor‑parallelism for multi‑GPU clusters.
- FlagOS is mentioned as a way to run the model on a broader range of AI accelerators.
When to pick Qwen‑Image‑2.1
- You need a single model that handles both generation and editing.
- Transparent‑background output is required.
- You prefer a relatively small (7 B) visual backbone that still delivers 2 K quality.
- You plan to serve many requests and want to leverage prefix‑KV caching for speed.
Resources
- Model cards on HuggingFace and ModelScope
- Blog post and demo space for quick visual tests
- Discord & WeChat community for support
- Detailed recipes for vLLM‑Omni, SGLang, LightX2V in the README.
Related
- Dispatch
- Dispatch
- Project
- Dispatch
- Dispatch