Image Generation & Editing
Qwen-Image-Edit takes a prompt plus an input image and returns an edited image. This page covers the download, the run recipe, and the two levers that decide how long an edit takes.
These commands follow the same conventions as the text-model recipes — the Hugging Face CLI, a source build from the repository root, and --backend swapped to match your hardware. See Download & run, per family.
Qwen-Image-Edit (image + prompt → edited image)
hf download unsloth/Qwen-Image-Edit-2511-GGUF qwen-image-edit-2511-Q4_K_M.gguf --local-dir models
hf download QuantStack/Qwen-Image-Edit-GGUF VAE/Qwen_Image-VAE.safetensors --local-dir models
hf download unsloth/Qwen2.5-VL-7B-Instruct-GGUF Qwen2.5-VL-7B-Instruct-Q4_K_M.gguf --local-dir models
hf download unsloth/Qwen2.5-VL-7B-Instruct-GGUF mmproj-BF16.gguf --local-dir models
hf download lightx2v/Qwen-Image-Edit-2511-Lightning Qwen-Image-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors --local-dir models
dotnet TensorSharp.Cli/bin/TensorSharp.Cli.dll --model models/qwen-image-edit-2511-Q4_K_M.gguf --image input.png \
--prompt "Make the sky a dramatic sunset." --output edited.png \
--qwen-image-vae models/VAE/Qwen_Image-VAE.safetensors \
--qwen-image-vl models/Qwen2.5-VL-7B-Instruct-Q4_K_M.gguf \
--qwen-image-mmproj models/mmproj-BF16.gguf \
--qwen-image-lora models/Qwen-Image-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors \
--backend ggml_cuda
dotnet TensorSharp.Server/bin/TensorSharp.Server.dll --model models/qwen-image-edit-2511-Q4_K_M.gguf \
--qwen-image-vae models/VAE/Qwen_Image-VAE.safetensors \
--qwen-image-vl models/Qwen2.5-VL-7B-Instruct-Q4_K_M.gguf \
--qwen-image-mmproj models/mmproj-BF16.gguf \
--qwen-image-lora models/Qwen-Image-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors \
--backend ggml_cuda
Image editing (Qwen-Image-Edit)
Qwen-Image-Edit takes a prompt + an input image and returns an edited image — a different output modality from the text LLMs above. The loaded qwen_image GGUF is only the MMDiT (multimodal diffusion transformer); TensorSharp resolves two companion GGUFs alongside it:
- Qwen-Image VAE — image ↔ 16-channel latent (the original
.safetensorsworks too). - Qwen2.5-VL-7B text encoder — prompt → 3584-dim conditioning, with an optional
mmprojvision tower for image-grounded edits.
Place the companions next to the DiT GGUF, or point at them with TS_QWEN_IMAGE_VAE / TS_QWEN_IMAGE_TE / TS_QWEN_IMAGE_MMPROJ (CLI: --qwen-image-vae / --qwen-image-vl / --qwen-image-mmproj). The pipeline VAE-encodes the reference, builds the conditioning, runs a FlowMatch-Euler true-CFG denoise loop (reference-latent concatenation), then VAE-decodes back to pixels. The whole 60-block DiT forward is CUDA-graph-captured and flash attention is on by default; the target area auto-clamps to the device VRAM budget unless you pin a width/height.
The speed lever is the Lightning distillation LoRA (--qwen-image-lora / TS_QWEN_IMAGE_LORA, a .safetensors file). TensorSharp parses the trained step count out of its file name (…-4steps-… / …8step…, 1–16 accepted) and switches the sampling defaults to that step count at cfg 1.0 with a fixed timestep shift of 3 — one DiT forward per step, no negative pass. Without it the base recipe is 30 steps at cfg 2.5, so the default 60 DiT forwards drop to 4–8. On the project's CUDA image_edit scenario (Q2_K DiT + 4-step Lightning LoRA, 544×1184, identical inputs and seed) a warm edit completes in 40.44 s against stable-diffusion.cpp's 48.16 s.
The LoRA is applied as a runtime F32 side-path next to each targeted projection (y = W·x + b + (alpha/rank)·up·(down·x)) with the quantized base weights untouched — it is not merged into them, because the Lightning deltas are far below a low-bit quantization step and a merge would be pure requantization noise. That side-path exists only on the whole-model and fused per-block CUDA forwards, so a Lightning LoRA on a fallback path (TS_QWEN_DIT_FUSED_BLOCK=0, TS_QWEN_DIT_NATIVE=0, or a non-CUDA backend) fails loudly rather than emitting noise. Stacking it on a base DiT that is already few-step (a file name containing rapid, turbo, hyper, lightning, lcm, nitro or step) is detected and warned about — such a checkpoint needs no LoRA.
Three fused graphs carry the rest, all on by default: the CUDA-graph-captured whole-DiT forward cut the per-forward cost ~2.9× and an 8-step denoise from ~153 s to ~63 s (TS_QWEN_DIT_WHOLE_CAPTURE=0 to disable); the fused conditioning-encoder trunks took text conditioning from 11.2 s to 2.5 s (TS_QWEN_TE_FUSED=0); and the fused whole-VAE graph took a 928×688 encode from 19.5 s to 0.95 s and the decode from 22.8 s to 1.35 s (TS_QWEN_VAE_FUSED=0). A whole-step DiT cache (TS_QWEN_DIT_CACHE_MODE = easycache / fbc / both) can skip 40–55% of the remaining steps, but it is off by default: on edit workloads it measurably softens fine detail such as faces, so quality comes first and you opt in.
Because the text and vision encoders are freed before the denoise loop starts, a larger text-encoder quantization costs nothing at denoise time while driving the whole edit's fidelity — Qwen2.5-VL-7B-Instruct-Q4_K_M.gguf (4.683 GB) is the recommended choice even on low-VRAM cards; the ~2-bit UD-IQ2_XXS build markedly softens faces.
Run it from the CLI (--image + --prompt), the Web UI image-edit flow (with live denoising previews), or in-process from C# via QwenImageModel.EditImage(). Full details are in the repository's docs/models/qwenimage.md card.