Qwen-Image-2.1-Nunchaku

Language: English | 中文

9.20 GiB less after load (46.4%) · text-to-image 2.69× faster · editing 2.19× faster

FP4 on an RTX 5090, compared with the BF16 transformer.

4-bit weight-and-activation quantization of the Qwen-Image-2.1 transformer, rank 32, for inference with Nunchaku. The repo has two checkpoints: FP4 for Blackwell (50-series) and INT4 for 30- and 40-series GPUs. The VAE stays in BF16. Diffusers components are included, so the repo loads as a pipeline.

Model

  • This repo: tonera/Qwen-Image-2.1-Nunchaku
  • FP4 transformer (Blackwell / 50-series): svdq-fp4_r32-Qwen-Image-2.1-Nunchaku.safetensors
  • INT4 transformer (30- and 40-series): svdq-int4_r32-Qwen-Image-2.1-Nunchaku.safetensors
  • Upstream: Qwen/Qwen-Image-2.1

Qwen-Image-2.1 is a unified text-to-image and image-editing model from Qwen. The visual generator is about 7B parameters, a 32-layer single-stream DiT. The same weights do text-to-image, reference-image editing, and transparent (RGBA) output. The official example uses 40 steps, true_cfg_scale=1, and prefix KV cache.

Samples

A blonde girl holds a wooden sign in her hand, which reads::CreatePPTX.com

BF16 FP4
BF16 FP4

Performance

1024×1024, true_cfg_scale=1, 30 steps, prefix KV cache on, CPU offload off, dtype bfloat16. BF16 and FP4 share the same INT4 text encoder, svdq-int4-Qwen3-VL-8B-Instruct-Nunchaku.safetensors. Measured on an RTX 5090.

Text-to-image

BF16 FP4
Load 9.549s 5.523s 1.73×
Cold inference 11.143s 4.273s 2.61×
Steady inference 10.973s 4.085s 2.69×

Image editing

The condition image is the BF16 sample above. Prompt: Turn the girl's hair black. Other settings match text-to-image.

BF16 FP4
Load 5.366s 4.579s 1.17×
Cold inference 13.349s 6.206s 2.15×
Steady inference 13.043s 5.964s 2.19×

Memory

BF16 FP4 Saved
Allocated after load 19.83 GiB 10.63 GiB 9.20 GiB (46.4%)
Reserved after load 19.89 GiB 10.68 GiB 9.22 GiB (46.3%)
Text-to-image peak allocated 26.44 GiB 17.23 GiB 9.22 GiB (34.8%)
Text-to-image peak reserved 27.92 GiB 18.46 GiB 9.46 GiB (33.9%)
Edit peak allocated 28.45 GiB 17.24 GiB 11.21 GiB (39.4%)
Edit peak reserved 30.47 GiB 18.46 GiB 12.01 GiB (39.4%)

Quality

Same FP4 run on an RTX 5090, 25 images each, compared with the BF16 transformer under the same settings. Higher PSNR and SSIM are closer. Lower LPIPS is closer. p90 is the 90th percentile of that metric.

Task Metric Mean p50 p90 Best Worst
Text-to-image PSNR ↑ 22.54 22.03 27.32 29.34 13.99
Text-to-image SSIM ↑ 0.877 0.896 0.964 0.974 0.599
Text-to-image LPIPS ↓ 0.164 0.162 0.299 0.041 0.435
Image editing PSNR ↑ 19.94 20.15 24.05 27.64 14.19
Image editing SSIM ↑ 0.752 0.764 0.890 0.918 0.527
Image editing LPIPS ↓ 0.147 0.113 0.281 0.040 0.348

Installation

Nunchaku must provide NunchakuQwenImage21Transformer2DModel, and Diffusers must provide QwenImage21Pipeline (after 2026-09-18, including PR #14804). Prebuilt wheels are in tonera/vitoom-nunchaku.

pip install "git+https://github.com/huggingface/diffusers.git"

python -m pip uninstall -y torch torchvision torchaudio nunchaku
python -m pip install "torch==2.14.*" "torchvision==0.29.*" --index-url https://download.pytorch.org/whl/cu130

# Pick the wheel that matches your Python, CUDA, and PyTorch from tonera/vitoom-nunchaku
hf download tonera/vitoom-nunchaku \
  nunchaku-1.4.0+cu13.0torch2.14-cp311-cp311-linux_x86_64.whl \
  --local-dir ./wheels

python -m pip install ./wheels/nunchaku-1.4.0+cu13.0torch2.14-cp311-cp311-linux_x86_64.whl

Usage

import torch
from diffusers import QwenImage21Pipeline
from PIL import Image
from nunchaku import NunchakuQwenImage21Transformer2DModel
from nunchaku.utils import get_precision

REPO = "tonera/Qwen-Image-2.1-Nunchaku"
NAME = "Qwen-Image-2.1-Nunchaku"

transformer = NunchakuQwenImage21Transformer2DModel.from_pretrained(
    f"{REPO}/svdq-{get_precision()}_r32-{NAME}.safetensors",
    torch_dtype=torch.bfloat16,
    device="cuda",
)
pipe = QwenImage21Pipeline.from_pretrained(
    REPO,
    transformer=transformer,
    torch_dtype=torch.bfloat16,
)
pipe.to("cuda")

image = pipe(
    prompt="A blonde girl holds a wooden sign in her hand, which reads::CreatePPTX.com",
    width=1024,
    height=1024,
    num_inference_steps=30,
    true_cfg_scale=1.0,
    use_kv_cache=True,
    generator=torch.Generator(device="cuda").manual_seed(42),
).images[0]
image.save("qwen21-w4a4.png")

ref = Image.open("input.png").convert("RGB")
edited = pipe(
    prompt="Turn the girl's hair black",
    image=ref,
    width=1024,
    height=1024,
    num_inference_steps=30,
    true_cfg_scale=1.0,
    use_kv_cache=True,
    generator=torch.Generator(device="cuda").manual_seed(42),
).images[0]
edited.save("qwen21-edit-w4a4.png")

License

These quantized weights are derived from Qwen/Qwen-Image-2.1 and follow the Qwen Research License. license: other in the model-card metadata is only a placeholder for the Hugging Face license field. The license linked above is what applies.

Downloads last month
102
Safetensors
Model size
7B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for tonera/Qwen-Image-2.1-Nunchaku

Quantized
(156)
this model