Qwen Image — 6 NFE
A six-step distilled Qwen-Image-2.1 Generator for text-to-image and image editing. This repository contains the complete Transformer weights (297 tensors, FP32, 28.46 GB) in eight standard Diffusers safetensors shards, not a LoRA or a training-state checkpoint. The included runner automatically obtains the text encoder, VAE, processor and scheduler from the pinned official base model.
Quick start
Use Python 3.10+ and a CUDA-compatible PyTorch installation. The runner uses BF16.
If this repository is private, first run hf auth login using an account with access.
Do not put access tokens in scripts or notebooks.
pip install -U huggingface_hub
hf download Sutoonq/Qwen-Image-2.1-6NFE-Distill inference.py requirements.txt config.json model_index.json --local-dir qwen6nfe
pip install -r qwen6nfe/requirements.txt
python qwen6nfe/inference.py --prompt "A mountain lake at sunrise" --output mountain.png
The final command downloads the checkpoint and the necessary official base-model components automatically, then runs six-step inference. No training repository or custom CUDA extension is required. Downloads are cached for later calls.
Image editing with your own reference:
python qwen6nfe/inference.py --image input.png --prompt "Change the background to a sunny garden" --output edited.png
Your own prompt / reference:
python qwen6nfe/inference.py --prompt "A small cabin beside a mountain lake at sunrise" --width 2048 --height 2048 --seed 42 --output result.png
python qwen6nfe/inference.py --image input.png --prompt "Change the scene to late autumn, preserving the stone bridge" --output edited.png
Add --cpu-offload to reduce GPU memory use at the cost of speed; sufficient CPU
RAM is still needed. High-resolution editing with reference images uses more
memory than text-to-image.
To download the whole repository for local use:
hf download Sutoonq/Qwen-Image-2.1-6NFE-Distill --local-dir qwen6nfe
python qwen6nfe/inference.py --model qwen6nfe --prompt "A mountain lake at sunrise"
The official base components are still required and downloaded on first use.
Repository layout and download statistics
The root config.json is an exact copy of transformer/config.json, describing
QwenImage21Transformer2DModel. The weights remain in transformer/, so component
loading still requires subfolder="transformer". The root copy is included in
the quick-start download for configuration inspection and download-statistics
troubleshooting; it does not make this a self-contained pipeline.
model_index.json describes the pipeline components, pinned base model, and
six-step inference settings. This is a transformer-only checkpoint, not a
self-contained Diffusers pipeline: use the runner or the integration example
below to obtain the remaining components from the official base model.
The runner reads _inference_settings from this file and caches it alongside
normal Hugging Face downloads. Older local exports without the file retain the
same six-step defaults.
Hugging Face counts Diffusers downloads using the root model_index.json (or
eligible root-level weight files). Whole-repository downloads and the updated
runner include this file. Downloading only transformer/ bypasses that counting
path. The root config.json has also been added as a diagnostic experiment:
the documented Diffusers counting filter lists model_index.json and eligible
root-level weights, whereas the default filter for repositories without a
library includes config.json. Whether the root configuration changes this
repository's observed count is not yet confirmed. Statistics are maintained by
Hugging Face.
See the official download statistics documentation.
Inference settings
- 6 model evaluations, Euler flow sampling.
- Conditional-only inference,
true_cfg_scale=1.0(no external CFG branch). - Preserve the base scheduler's resolution-dependent dynamic shift, but set
shift_terminal=0.4. The sixth evaluated sigma is 0.4 and the final Euler update maps to zero. The runner applies this automatically. - Default output resolution: approximately 2048 pixels per side; explicit width and height can be supplied and are aligned by the official pipeline.
- The pinned Diffusers revision and Transformers version are in
requirements.txt.
Minimal integration into an existing Diffusers application:
import json
import torch
from huggingface_hub import hf_hub_download
from diffusers import (
QwenImage21Pipeline, QwenImage21Transformer2DModel,
FlowMatchEulerDiscreteScheduler,
)
with open(hf_hub_download(
"Sutoonq/Qwen-Image-2.1-6NFE-Distill", "model_index.json",
), encoding="utf-8") as f:
settings = json.load(f)["_inference_settings"]
transformer = QwenImage21Transformer2DModel.from_pretrained(
"Sutoonq/Qwen-Image-2.1-6NFE-Distill", subfolder="transformer",
torch_dtype=torch.bfloat16,
)
pipe = QwenImage21Pipeline.from_pretrained(
"Qwen/Qwen-Image-2.1",
revision="b3179ad355be050328e483a9dfdd9e60cd62adfa",
transformer=transformer, torch_dtype=torch.bfloat16,
).to("cuda")
pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(
pipe.scheduler.config, shift_terminal=settings["shift_terminal"],
)
image = pipe(
prompt="A mountain lake at sunrise",
num_inference_steps=settings["num_inference_steps"],
true_cfg_scale=settings["true_cfg_scale"], width=2048, height=2048,
output_resolution=2048,
generator=torch.Generator("cuda").manual_seed(42),
).images[0]
image.save("result.png")
Selected examples
Text-to-image

Prompts and results
Each column shows the prompt above its generated image. The Prompt Enhancement entries below summarize the longer prompts used for generation.
Image editing
Reference images on the left; edited results on the right.

License
The Qwen Research License and official base-model terms apply.