Model setup recipes

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.

Requirements and key details
  • The Q4_K_M model file is 4.2 GB; the Q8_0 model file is 7.64 GB.
  • The recommended GGUF text encoder is Qwen3-VL-8B-Instruct-UD-Q4_K_XL.
  • For image editing, check the dedicated VAE and vision projector 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.

Use these file sizes to plan storage; assess runtime memory separately.
ComponentFileFile size
Q4 generation modelqwen-image-2.1-Q4_K_M.gguf4.2GB
Q4 text encoderQwen3-VL-8B-Instruct-UD-Q4_K_XL.gguf5.15GB
Image-decoding VAEqwen_image_2.1_vae_bf16.safetensors0.68GB
Files needed besides the Q4 denoiser — Qwen-Image 2.1 · Unsloth GGUF · download sizes
The sum is the download size, not the total VRAM needed to run the model.
Modules are separated across three stands on a workbench.
The model, encoder, and VAE each handle a different stage.

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.

Node map from the official Qwen-Image 2.1 JSON linking resolution selection to the generation subgraph and PNG saving
Connections and defaults from the official JSON, not a UI screenshot. Load the workflow, then select the model files.
Official Qwen-Image 2.1 output of a person with sunglasses and a handbag against lime-green and black-and-white patterns
An official example output. An image alone does not establish generation time or Korean text accuracy.
Input portrait for the official Qwen-Image 2.1 clothing-edit example

Before

Output portrait from the official Qwen-Image 2.1 clothing-edit example

After

Input and output of the official clothing-edit example. Check whether the face and pose are preserved as well as the clothing change.

Source: Comfy Org · MIT license

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.

Download the three required files
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 models
The VAE is saved in the models/vae subfolder.

Save 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.

Q4 text-to-image generation
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
If memory is tight, check supported CPU offloading and test with a lower resolution.
Blocks and a drawer with free space are shown beside a computer.
Leave compute workspace after loading the components.

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.

A teapot image and printout sit on a laptop desk.
Complete one image first, then change conditions one at a time.

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

  1. GGUF — A file format for model data, widely used by llama.cpp-based tools.

    Back to the text
  2. Prompt — The input text sent to a model. For generative models it describes the desired result and strongly shapes the output.

    Back to the text
  3. VAE — Short for Variational Autoencoder. It can encode input into a compact latent representation or decode that representation into an output.

    Back to the text
  4. BF16 — 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 text
  5. Unified memory — An architecture where the CPU and GPU share one physical memory pool.

    Back to the text
  6. Quantization — 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 text
  7. Runtime — 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 text
  8. CUDA — A software platform for general-purpose computing on NVIDIA GPUs.

    Back to the text
  9. Metal — Apple’s low-level technology for graphics and parallel GPU computation.

    Back to the text
  10. CFG — 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 text
  11. GPU — A processor designed to handle many calculations in parallel. It performs model computations during AI inference.

    Back to the text
  12. CPU — 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 text
  13. Offloading — Moving some model data from GPU memory to system RAM or storage when capacity is limited. This adds data transfer.

    Back to the text
  14. System RAM — System memory that temporarily holds data while programs run.

    Back to the text
  15. SSD — 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.