Qwen-Image from the Qwen team is an image generation foundation model in the Qwen series that achieves significant advances in complex text rendering and precise image editing. Experiments show strong general capabilities in both image generation and editing, with exceptional performance in text rendering, especially for Chinese.
Qwen-Image comes in the following variants:
| model type | model id |
|---|---|
| Qwen-Image | Qwen/Qwen-Image |
| Qwen-Image-Edit | Qwen/Qwen-Image-Edit |
| Qwen-Image-Edit Plus | Qwen/Qwen-Image-Edit-2509 |
[!TIP] Caching may also speed up inference by storing and reusing intermediate outputs.
Use a LoRA from lightx2v/Qwen-Image-Lightning to speed up inference by reducing the
number of steps. Refer to the code snippet below:
[!TIP] The
guidance_scaleparameter in the pipeline is there to support future guidance-distilled models when they come up. Note that passingguidance_scaleto the pipeline is ineffective. To enable classifier-free guidance, please passtrue_cfg_scaleandnegative_prompt(even an empty negative prompt like “ “) should enable classifier-free guidance computations.
With [QwenImageEditPlusPipeline], one can provide multiple images as input reference.
import torch
from PIL import Image
from diffusers import QwenImageEditPlusPipeline
from diffusers.utils import load_image
pipe = QwenImageEditPlusPipeline.from_pretrained(
"Qwen/Qwen-Image-Edit-2509", torch_dtype=torch.bfloat16
).to("cuda")
image_1 = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/grumpy.jpg")
image_2 = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/peng.png")
image = pipe(
image=[image_1, image_2],
prompt='''put the penguin and the cat at a game show called "Qwen Edit Plus Games"''',
num_inference_steps=50
).images[0]
[[autodoc]] QwenImagePipeline
[[autodoc]] QwenImageImg2ImgPipeline
[[autodoc]] QwenImageInpaintPipeline
[[autodoc]] QwenImageEditPipeline
[[autodoc]] QwenImageEditInpaintPipeline
[[autodoc]] QwenImageControlNetPipeline
[[autodoc]] QwenImageEditPlusPipeline
[[autodoc]] pipelines.qwenimage.pipeline_output.QwenImagePipelineOutput