Model setup recipes
Last updated
Qwen-Image 2.1 GGUF download: choosing Q4_K_M, Q8_0 and the VAE
Prepare the Qwen-Image 2.1 GGUF model, encoder, and VAE together
This guide shows how to generate images from text with Unsloth's Qwen-Image 2.1 GGUF1 and, if needed, move on to editing a reference photo. Prepare the Q4 files and check that the generated image is saved locally.
First, use a text prompt2 to generate a 20-step, 1024×1024 image and confirm that the output file is saved locally. For reference-photo editing, prepare the required vision files and test the generation and editing input paths separately.
A first generation needs three different files
For text-to-image generation with Qwen-Image 2.1, specify the Q4_K_M model, Qwen3-VL-8B-Instruct-UD-Q4_K_XL encoder, and the dedicated qwen_image_2.1_vae_bf16.safetensors VAE3. Do not substitute a VAE from older Qwen-Image or Wan 2.2. A mismatched role or version can prevent loading or produce unintended output.
| Component | File | File size |
|---|---|---|
| Q4 generation model | qwen-image-2.1-Q4_K_M.gguf | 4.2GB |
| Q4 text encoder | Qwen3-VL-8B-Instruct-UD-Q4_K_XL.gguf | 5.15GB |
| Image-decoding VAE | qwen_image_2.1_vae_bf16.safetensors | 0.68GB |

Distinguish file size from runtime memory
Unsloth's model files are 4.2 GB for Q4_K_M, 5.39 GB for Q5_K_M, 6.27 GB for Q6_K, and 7.64 GB for Q8_0. These are disk sizes for the model alone. During execution, the encoder, bf164 VAE, image-size-dependent buffers, and applications need additional space. macOS and other apps also share unified memory5.
Quantization6 shrinks the weights but does not fix total runtime7 memory. Comparing lettering, kettle outlines and background patterns with the same prompt and seed shows output differences. The published Mac Q4/Q8 timing difference also involved different encoder precision, so it does not isolate the effect of the main model's bit width.
Inspect the workflow alongside its output
These are Qwen-Image 2.1 examples published by Comfy Org, not outputs or timing measurements produced by this site.



Before

After
Download only the three required files
If the hf tool is installed, use these commands to download only the required files into the models folder. Complete any required authentication or license agreement on the repository page first. The files total 4.2+5.15+0.68=10.03 GB, so allow about 10 GB of disk storage for the downloads. This total is not a runtime-memory estimate.
hf download unsloth/Qwen-Image-2.1-GGUF qwen-image-2.1-Q4_K_M.gguf --local-dir models
hf download unsloth/Qwen3-VL-8B-Instruct-GGUF Qwen3-VL-8B-Instruct-UD-Q4_K_XL.gguf --local-dir models
hf download unsloth/Qwen-Image-2.1-FP8 vae/qwen_image_2.1_vae_bf16.safetensors --local-dir modelsSave a first image with the Q4 setup
Prepare a CUDA8 or Metal9 build of stable-diffusion.cpp's sd-cli that supports Qwen-Image 2.1. The command below uses the Unsloth card's example settings: 20 steps, CFG10 6.0, Euler, and a 1024-square image. On Windows, specify the actual path to sd-cli.exe. It saves qwen21-first.png locally rather than starting an external server.
After generation, confirm that the file exists, is non-empty, and opens in an image app. Check that the third file is in models/vae and that the command path matches. To compare with a 40-step timing report, match the runtime and measurement interval too.
sd-cli --diffusion-model models/qwen-image-2.1-Q4_K_M.gguf \
--vae models/vae/qwen_image_2.1_vae_bf16.safetensors \
--llm models/Qwen3-VL-8B-Instruct-UD-Q4_K_XL.gguf \
-p "A green ceramic teapot on an oak table, soft window light, simple cream background" \
--steps 20 --cfg-scale 6.0 --sampling-method euler \
-W 1024 -H 1024 --diffusion-fa -o qwen21-first.png
On lower-memory GPUs, account for the encoder and workspace too
On a 12–16 GB GPU11, start with Q4, one image, and no more than 1024 resolution, then check logs for encoder placement and CPU12 offloading13. A larger encoder and intermediate buffers still use memory even if the model is quantized further. Check separately whether the model loads and whether it can be run repeatedly within an acceptable time.
Offloading can add transfer and computation time between RAM14 and GPU. If unified memory runs short on a Mac, SSD15 swapping can increase delays. Close other GPU workloads and start with one image, judging repeatable speed and output quality as well as whether it runs at all.

Connect a vision projector for reference-image editing
Even when text-to-image works, reference-image editing may need a separate mmproj vision file in addition to the encoder. The stable-diffusion.cpp editing path connects it with --llm_vision. Use a file matching the model family and provide the photo with -r. Start with one image to check the model and app's image-input path.
Test changing a reference photo's background and check the runtime logs to confirm the photo was read. If you need transparency, check that the alpha channel is retained in PNG or a supported WebP output.
Record conditions and license, then compare again
When starting sd-cli from scratch each time, include model loading in total wait. If you send requests to a server with the model already loaded, record request time separately after setup. Note the three filenames, runtime version, prompt, seed, resolution, steps, offloading, and memory to compare changes in quantization or editing input.
The installation example carries no performance measurements of its own. For commercial use, check how the research license applies to the model and its distribution.
Terminology notes
GGUF — A file format for model data, widely used by llama.cpp-based tools.
Back to the textPrompt — The input text sent to a model. For generative models it describes the desired result and strongly shapes the output.
Back to the textVAE — Short for Variational Autoencoder. It can encode input into a compact latent representation or decode that representation into an output.
Back to the textBF16 — A 16-bit floating-point format for model values. Its exponent has the same width as FP32, giving it a similarly wide value range.
Back to the textUnified memory — An architecture where the CPU and GPU share one physical memory pool.
Back to the textQuantization — A way to represent model weights or values with fewer bits, reducing storage and memory use. The coarser representation can also affect accuracy.
Back to the textRuntime — The software environment that provides facilities needed while a program runs. In local AI, it can also refer to a model execution engine.
Back to the textCUDA — A software platform for general-purpose computing on NVIDIA GPUs.
Back to the textMetal — Apple’s low-level technology for graphics and parallel GPU computation.
Back to the textCFG — A technique that combines conditioned and unconditioned predictions to adjust how generation follows its input. Distilled models may require it to be disabled; recommended values vary by model.
Back to the textGPU — A processor designed to handle many calculations in parallel. It performs model computations during AI inference.
Back to the textCPU — The central processor that runs the operating system and general-purpose instructions; in AI workloads it also handles tasks such as preprocessing and data movement.
Back to the textOffloading — Moving some model data from GPU memory to system RAM or storage when capacity is limited. This adds data transfer.
Back to the textSystem RAM — System memory that temporarily holds data while programs run.
Back to the textSSD — A data storage device that uses flash memory and retains data without power.
Back to the text
Frequently asked questions
- What should you check first in this article?
- This guide shows how to generate images from text with Unsloth's Qwen-Image 2.1 GGUF and, if needed, move on to editing a reference photo. Prepare the Q4 files and check that the generated image is saved locally.
- How much memory does it need?
- Unsloth's model files are 4.2 GB for Q4_K_M, 5.39 GB for Q5_K_M, 6.27 GB for Q6_K, and 7.64 GB for Q8_0. These are disk sizes for the model alone. During execution, the encoder, bf16 VAE, image-size-dependent buffers, and applications need additional space. macOS and other apps also share unified memory.
- Where can you check the conditions and sources?
- The installation example carries no performance measurements of its own. For commercial use, check how the research license applies to the model and its distribution.
Read next
Image and video generation
Qwen-Image-2.1-Turbo: How Do You Generate and Edit Images in 8 Steps?
Image and video generation
Run Pruna-Qwen-Image-2.1 locally: choosing its 5- or 8-step adapter
Image and video generation
Qwen-Image 2.1: local image generation and editing
Response speed and acceleration
Qwen-Image 2.1 speed on RTX 5090 and Mac
