RepoQwen (Alibaba Cloud)Qwen (Alibaba Cloud)published Sep 14, 2026seen 3w

QwenLM/Qwen-Image-2.1

Python

Open original ↗

Captured source

source ↗
published Sep 14, 2026seen 3wcaptured 3whttp 200method plain

QwenLM/Qwen-Image-2.1

Description: Qwen's most powerful open-source image generation model

Language: Python

License: NOASSERTION

Stars: 695

Forks: 26

Open issues: 3

Created: 2026-09-14T04:12:17Z

Pushed: 2026-09-20T12:25:51Z

Default branch: main

Fork: no

Archived: no

README:

🤖 ModelScope | 🤗 HuggingFace | 📑 Blog | 🖥️ Demo | 🫨 Discord

Introduction

We are excited to open-source Qwen-Image-2.1, a unified text-to-image generation and image editing model in the Qwen family. With just 7B parameters in its visual generation component (32 Single-Stream DiT layers), Qwen-Image-2.1 balances generation quality, inference efficiency, and versatility.

Four key improvements define this release:

  • Compact and Efficient — A lightweight architecture with mixed-granularity attention and prefix KV cache reuse delivers strong image quality at low computational cost.
  • Native Transparency, Unified Creation and Editing — Generate regular or transparent (RGBA) images from text, edit transparent layers, and extract subjects from photographs—all in one model.
  • Versatile Editing — Support up to 10 reference images, specify local edits via circles, painted annotations, or separate masks, and preserve identity for people and products.
  • Realistic Textures and Refined Aesthetics — Improved typography, portrait lighting, and fine details for more visually compelling results.

News

  • 2026.09.20: We released Qwen-Image-2.1! Check our Blog for more details. Weights available at HuggingFace and ModelScope.
  • 2026.09.20: Diffusers supports Qwen-Image-2.1 from Day 0 via QwenImage21Pipeline. See PR #14804.
  • 2026.09.20: ComfyUI natively supports Qwen-Image-2.1 from Day 0. Compatible weights at Comfy-Org/Qwen-Image-2.1, with example workflows for text-to-image and image editing.
  • 2026.09.20: vLLM-Omni supports high-performance Qwen-Image-2.1 inference from Day 0, with step-wise execution, prefix KV caching, CUDA Graph decode, FP8 quantization, and TP/Ulysses parallelism.
  • 2026.09.20: SGLang provides Day-0 native support for Qwen-Image-2.1, including prefix caching, Cache-DiT, CUDA graphs, TP/Ulysses/Ring/CFG parallelism, and component offload. See PR #39983.
  • 2026.09.20: LightX2V delivers Day 0 acceleration for Qwen-Image-2.1! Check out the usage guide for more details.

Quick Start

Requirements

pip install torch>=2.4.0
pip install transformers>=5.17
pip install git+https://github.com/huggingface/diffusers
pip install accelerate
pip install 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",
num_inference_steps=40,
generator=torch.Generator("cuda").manual_seed(42),
).images[0]

image.save("t2i_example.png")

Image Editing (Single Image)

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 Editing (Multiple Reference Images)

Qwen-Image-2.1 supports up to 10 reference images for multi-subject composition:

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")

images = [Image.open(f"ref_{i}.png") for i in range(3)]

result = pipe(
prompt="These three characters are sitting around a campfire in a forest",
image=images,
num_inference_steps=40,
generator=torch.Generator("cuda").manual_seed(42),
).images[0]

result.save("multi_ref_example.png")

Transparent Image Generation (RGBA)

The model natively generates transparent images. For best results, use the recommended prompt format:

> This is an RGBA image with transparency. . The image has alpha channel and the background is transparent.

import torch
from diffusers import QwenImage21Pipeline

pipe = QwenImage21Pipeline.from_pretrained(
"Qwen/Qwen-Image-2.1", torch_dtype=torch.bfloat16
).to("cuda")

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.",
num_inference_steps=40,
generator=torch.Generator("cuda").manual_seed(42),
).images[0]

image.save("transparent_example.png") # Saved as RGBA when the model generates transparency

Supported Aspect Ratios

Qwen-Image-2.1 natively supports 2K resolution. Recommended sizes:

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),
}

width, height = aspect_ratios["1:1"]

image = pipe(
prompt="A panoramic mountain landscape",
width=width,
height=height,
num_inference_steps=40,
).images[0]

Default Parameters

| Parameter | Default | Notes | |---|---|---| | num_inference_steps | 40 | Number of denoising steps | | width / height | 2048 × 2048 | Native 2K resolution; see aspect ratio table above |

Prompt Rewriting

For best results, we recommend using the official prompt rewriting models to expand short prompts into detailed, high-quality descriptions. Two fine-tuned Qwen3.5-VL 9B checkpoints are...

Excerpt shown — open the source for the full document.