File size: 3,018 Bytes
bb5a786 895c5e8 bb5a786 895c5e8 bb5a786 895c5e8 b4bafd0 895c5e8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | ---
title: Qwen-Image-2.1
emoji: 🖼️
colorFrom: indigo
colorTo: pink
sdk: gradio
sdk_version: 6.28.0
app_file: app.py
short_description: Generate and edit images with Qwen-Image-2.1
python_version: "3.12"
startup_duration_timeout: 1h
license: other
license_name: qwen-research
license_link: https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE
---
# Qwen-Image-2.1
Text-to-image generation and multi-image editing with
[`Qwen/Qwen-Image-2.1`](https://huggingface.co/Qwen/Qwen-Image-2.1), running on ZeroGPU
through the `QwenImage21Pipeline` in `diffusers`.
* **Text to image** — leave the input gallery empty and describe what you want.
* **Image editing** — upload up to 10 images and refer to them as `<image1>` … `<image10>`
in the prompt (upload order).
* **Transparency** — the model natively decodes RGBA. Ask for it in the prompt, e.g.
*"This is an RGBA image with transparency. … The image has alpha channel and the
background is transparent."*
## Prompt enhancement
The **Enhance prompt** checkbox calls a companion Space,
[`hugging-apps/qwen-image-2-1-prompt-enhancer`](https://huggingface.co/spaces/hugging-apps/qwen-image-2-1-prompt-enhancer),
which keeps both official rewriters (`Qwen-Image-2.1-PE-T2I` and `Qwen-Image-2.1-PE-I2I`)
warm and resident on their own GPU worker. Splitting them out keeps this Space's GPU
allocation dedicated to diffusion.
## Speed
The transformer blocks and the VAE decoder run as ahead-of-time compiled kernels (PyTorch
AOTInductor) published in
[`hugging-apps/qwen-image-2-1-aoti`](https://huggingface.co/hugging-apps/qwen-image-2-1-aoti) and
built by [`hugging-apps/qwen-image-2-1-aoti-compile`](https://huggingface.co/spaces/hugging-apps/qwen-image-2-1-aoti-compile).
One dynamic-shape artifact per module covers every resolution, aspect ratio and number of
condition images; the first denoising step (the block-causal prefill) and the text encoder stay
eager. Set the `QWEN21_AOTI=0` variable to run fully eager.
Everything stays resident on the GPU. Outputs above 1536 px decode in tiles, and the prefix KV
cache is switched off for requests whose condition images would not fit next to the weights
(it costs about 2 GB per 1K-pixel condition image), which keeps many-image edits running at the
cost of speed.
## Safety
Editing requests (any submission with input images) are screened with
[`hfmlsoc/ncii-guard-v02`](https://huggingface.co/hfmlsoc/ncii-guard-v02) before anything
is generated.
## Example assets
The images under `examples/` are the official demo assets from the
[`Qwen/Qwen-Image-2.1`](https://huggingface.co/spaces/Qwen/Qwen-Image-2.1) Space,
redistributed here under the Qwen Research License for non-commercial demonstration.
## License
> Qwen is licensed under the Qwen RESEARCH LICENSE AGREEMENT, Copyright (c) 2026
> Hangzhou Tongyi Laboratory Technology Co., Ltd. All Rights Reserved.
Research / evaluation use only — see the
[license](https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE).
|