Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Pin the Dynamic 2.0 4-bit text encoder for Qwen-Image-2.1's native route (#11542)

Daniel Han71912e86e5ea
diff --git a/studio/backend/core/inference/diffusion_families.py b/studio/backend/core/inference/diffusion_families.py
index 2b6cd356019..8999bae3fe9 100644
--- a/studio/backend/core/inference/diffusion_families.py
+++ b/studio/backend/core/inference/diffusion_families.py
@@ -417,7 +417,11 @@ _FAMILIES: tuple[DiffusionFamily, ...] = (
sd_cpp_vae = ("unsloth/Qwen-Image-2.1-FP8", "vae/qwen_image_2.1_vae_bf16.safetensors"),
# Qwen3-VL 8B, not Qwen2.5-VL, and supplied through --llm rather than --qwen2vl: the
# qwen2vl flag carries Qwen2-VL's vision preprocessing, which this encoder does not want.
- # Q4_K_M keeps the CPU RAM win the no-GPU route exists for (bf16 is 16.4 GB, this is 4.7).
+ # UD-Q4_K_XL, the Dynamic 2.0 rung, rather than the uniform Q4_K_M: same 4-bit class and
+ # the same CPU RAM win the no-GPU route exists for (bf16 is 16.4 GB, this is 5.1 against
+ # 5.0), with the per-tensor precision the dynamic recipe assigns. Measured on this host
+ # against the 2.1-capable build, one prompt at 1024 with 20 steps and a shared seed:
+ # LPIPS 0.02894 / SSIM 0.95908 between the two, 36.5 s against 39.0 s, both coherent.
# Text to image only, which is all this family exposes (edit is False, and there are no
# img2img / inpaint pipelines). Upstream's docs/qwen_image_2.1.md requires a separate
# mmproj through --llm_vision before a GGUF encoder can do image editing; turning editing
@@ -425,7 +429,7 @@ _FAMILIES: tuple[DiffusionFamily, ...] = (
sd_cpp_text_encoders = (
(
"unsloth/Qwen3-VL-8B-Instruct-GGUF",
- "Qwen3-VL-8B-Instruct-Q4_K_M.gguf",
+ "Qwen3-VL-8B-Instruct-UD-Q4_K_XL.gguf",
"llm",
),
),
diff --git a/studio/backend/tests/test_diffusion_compat_preflight.py b/studio/backend/tests/test_diffusion_compat_preflight.py
index aaaa1b1454c..af9db4b1aeb 100644
--- a/studio/backend/tests/test_diffusion_compat_preflight.py
+++ b/studio/backend/tests/test_diffusion_compat_preflight.py
@@ -1708,3 +1708,20 @@ def test_the_chat_backend_does_not_import_pyyaml_to_learn_the_speech_verdict():
assert not hasattr(
gguf_metadata, name
), f"{name} must be imported from utils.gguf_archs, not through utils.models"
+
+
+def test_qwen_image_2_1_takes_the_dynamic_4bit_text_encoder():
+ """The no-GPU route's encoder is pinned by FILENAME, and a name that is not in the repo is
+ not an error anyone sees at config time: the fetch 404s mid-load, after the denoiser has
+ already been staged. Pin the Dynamic 2.0 rung by exact name so a rename or a drop to the
+ uniform quant has to break this rather than a user's load."""
+ from core.inference.diffusion_families import detect_family
+
+ fam = detect_family("Qwen/Qwen-Image-2.1")
+ assert fam.sd_cpp_text_encoders == (
+ (
+ "unsloth/Qwen3-VL-8B-Instruct-GGUF",
+ "Qwen3-VL-8B-Instruct-UD-Q4_K_XL.gguf",
+ "llm",
+ ),
+ )