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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Fix Studio loaded-model GGUF quant label (#8238)
Lee Jackson1357ee85fff9
diff --git a/studio/backend/core/inference/diffusion.py b/studio/backend/core/inference/diffusion.pyindex 3f2fdb4cc9f..1b655a3b384 100644--- a/studio/backend/core/inference/diffusion.py+++ b/studio/backend/core/inference/diffusion.py@@ -4386,6 +4386,7 @@ class DiffusionBackend:"device": None,"dtype": None,"model_kind": None,+ "gguf_variant": None,"cpu_offload": False,"offload_policy": None,"vae_tiling": False,@@ -4402,6 +4403,7 @@ class DiffusionBackend:"resolved": None,}from core.inference import diffusion_controlnet, diffusion_lora+ from hub.utils.gguf import extract_quant_tokenreturn {"loaded": True,@@ -4411,6 +4413,11 @@ class DiffusionBackend:"device": state.device,"dtype": state.dtype,"model_kind": state.kind,+ "gguf_variant": (+ extract_quant_token(state.gguf_filename)+ if state.kind == "gguf" and state.gguf_filename+ else None+ ),"cpu_offload": state.cpu_offload,"offload_policy": state.offload_policy,"vae_tiling": state.vae_tiling,diff --git a/studio/backend/core/inference/sd_cpp_backend.py b/studio/backend/core/inference/sd_cpp_backend.pyindex 9afd4a49e20..5613844ee8b 100644--- a/studio/backend/core/inference/sd_cpp_backend.py+++ b/studio/backend/core/inference/sd_cpp_backend.py@@ -1453,6 +1453,7 @@ class SdCppDiffusionBackend:"base_repo": None,"device": None,"dtype": None,+ "gguf_variant": None,"cpu_offload": False,"offload_policy": None,"vae_tiling": False,@@ -1470,6 +1471,7 @@ class SdCppDiffusionBackend:"workflows": [],}from core.inference import diffusion_lora+ from hub.utils.gguf import extract_quant_tokenreturn {"loaded": True,@@ -1478,6 +1480,9 @@ class SdCppDiffusionBackend:"base_repo": state.base_repo,"device": state.device,"dtype": "gguf",+ "gguf_variant": extract_quant_token(state.gguf_filename)+ if state.gguf_filename+ else None,# Reflect the offload flags actually passed to sd-cli (empty on CPU -> "none")."cpu_offload": bool(state.offload_flags),"offload_policy": "active" if state.offload_flags else "none",diff --git a/studio/backend/core/inference/video.py b/studio/backend/core/inference/video.pyindex 443d2c284f0..e8718bcb2e4 100644--- a/studio/backend/core/inference/video.py+++ b/studio/backend/core/inference/video.py@@ -2351,6 +2351,7 @@ class VideoBackend:"device": None,"dtype": None,"model_kind": None,+ "gguf_variant": None,"offload_policy": None,"vae_tiling": False,"memory_mode": None,@@ -2364,6 +2365,8 @@ class VideoBackend:"defaults": None,"resolved": None,}+ from hub.utils.gguf import extract_quant_token+fam = state.familydefault_steps, default_guidance = default_video_generation_params(state.gguf_filename,@@ -2379,6 +2382,12 @@ class VideoBackend:"device": state.device,"dtype": state.dtype,"model_kind": state.kind,+ # As on the image runtime: dtype is compute precision, which labelled a Q4_K_M BF16.+ "gguf_variant": (+ extract_quant_token(state.gguf_filename)+ if state.kind == "gguf" and state.gguf_filename+ else None+ ),"offload_policy": state.offload_policy,"vae_tiling": state.vae_tiling,"memory_mode": state.memory_mode,diff --git a/studio/backend/models/inference.py b/studio/backend/models/inference.pyindex 924f8340c0c..8cac50c07fa 100644--- a/studio/backend/models/inference.py+++ b/studio/backend/models/inference.py@@ -2969,6 +2969,9 @@ class DiffusionStatusResponse(BaseModel):model_kind: Optional[str] = Field(None, description = "Resolved load kind: gguf | single_file | pipeline (gates GGUF-only UI)")+ gguf_variant: Optional[str] = Field(+ None, description = "Selected GGUF quantisation variant (for example Q8_0)"+ )cpu_offload: bool = Field(False, description = "Whether CPU offload is engaged")offload_policy: Optional[str] = Field(None, description = "Resolved offload policy: none | group | model | streaming | sequential"@@ -3417,6 +3420,9 @@ class VideoStatusResponse(BaseModel):model_kind: Optional[str] = Field(None, description = "Resolved load kind: gguf | single_file | pipeline (gates GGUF-only UI)")+ gguf_variant: Optional[str] = Field(+ None, description = "Selected GGUF quantisation variant (for example Q8_0)"+ )offload_policy: Optional[str] = Field(None, description = "Resolved offload policy: none | group | model | sequential")diff --git a/studio/backend/tests/test_diffusion_backend.py b/studio/backend/tests/test_diffusion_backend.pyindex 9cf4dd21701..7cec9f3e19e 100644--- a/studio/backend/tests/test_diffusion_backend.py+++ b/studio/backend/tests/test_diffusion_backend.py@@ -693,6 +693,23 @@ def test_load_generate_unload_gguf(fake_runtime, tmp_path):assert backend.is_loaded is False+def test_gguf_status_reports_selected_quant_instead_of_only_compute_dtype(fake_runtime, tmp_path):+ filename = "z-image-turbo-Q8_0.gguf"+ (tmp_path / filename).write_bytes(b"weights")+ backend = DiffusionBackend()++ status = backend.load_pipeline(+ str(tmp_path),+ gguf_filename = filename,+ base_repo = "base/repo",+ family_override = "z-image",+ )++ assert status["dtype"] == "float32" # compute dtype is a separate concern+ assert status["gguf_variant"] == "Q8_0"+ assert backend.unload()["gguf_variant"] is None++def test_generate_progress_active_during_setup(fake_runtime, tmp_path, monkeypatch):# Active must be published the moment the lock is held, before the slow setup that _apply_loras runs in.(tmp_path / "model.gguf").write_bytes(b"weights")@@ -4471,6 +4488,11 @@ def test_diffusion_status_response_carries_requested_precision():assert resp.model_dump()["resolved"] == rec+def test_diffusion_status_response_carries_gguf_variant():+ from models.inference import DiffusionStatusResponse+ assert DiffusionStatusResponse(loaded = True, gguf_variant = "Q8_0").gguf_variant == "Q8_0"++def test_companion_cache_bytes_local_dir_excludes_transformer(tmp_path):# A local diffusers base: sum the on-disk VAE / text-encoder weights, excluding transformer/ (the GGUF supplies it) and non-weight files.(tmp_path / "vae").mkdir()diff --git a/studio/backend/tests/test_sd_cpp_backend.py b/studio/backend/tests/test_sd_cpp_backend.pyindex ac1869d733a..183dc8e3511 100644--- a/studio/backend/tests/test_sd_cpp_backend.py+++ b/studio/backend/tests/test_sd_cpp_backend.py@@ -469,6 +469,7 @@ def test_status_loaded_shape():assert st["engine"] == "sd_cpp"assert st["family"] == "z-image"assert st["device"] == "cpu"+ assert st["gguf_variant"] is None# diffusers-only fields are present (route response parity) but null.for k in ("transformer_quant", "attention_backend", "transformer_cache", "text_encoder_quant"):assert st[k] is None@@ -750,6 +751,7 @@ def _run_server_load(servers,fam_name = "z-image",device = "cpu",+ gguf_filename = "z.gguf",):fam = detect_family(fam_name)monkeypatch.setattr(bk, "find_sd_server_binary", lambda: "/x/sd-server")@@ -775,7 +777,7 @@ def _run_server_load(b._load_token = 1b._run_load(repo_id = "unsloth/Z-Image-Turbo-GGUF",- gguf_filename = "z.gguf",+ gguf_filename = gguf_filename,base = fam.base_repo,fam = fam,hf_token = None,@@ -793,6 +795,13 @@ def test_server_load_spawns_once_and_status_reports_mode(monkeypatch):assert b.status()["native_mode"] == "server"+def test_server_status_reports_selected_gguf_quant(monkeypatch):+ b = SdCppDiffusionBackend()+ servers: list = []+ _run_server_load(monkeypatch, b, servers, gguf_filename = "z-image-turbo-Q8_0.gguf")+ assert b.status()["gguf_variant"] == "Q8_0"++def test_server_generate_uses_one_request_for_whole_batch(monkeypatch):b = SdCppDiffusionBackend()servers: list = []diff --git a/studio/backend/tests/test_video_backend.py b/studio/backend/tests/test_video_backend.pyindex 41362dc1ffc..f4a400dd256 100644--- a/studio/backend/tests/test_video_backend.py+++ b/studio/backend/tests/test_video_backend.py@@ -1383,6 +1383,37 @@ def test_video_step_cache_auto_from_default_schedule(fake_runtime, tmp_path):backend.unload()+def test_video_gguf_status_reports_selected_quant_instead_of_only_compute_dtype(+ fake_runtime, tmp_path+):+ filename = "ltx-2.3-22b-distilled-1.1-Q4_K_M.gguf"+ (tmp_path / filename).write_bytes(b"w")+ backend = VideoBackend()++ status = backend.load_pipeline(+ str(tmp_path),+ gguf_filename = filename,+ base_repo = "Lightricks/LTX-2",+ family_override = "ltx-2",+ )++ assert status["gguf_variant"] == "Q4_K_M"+ assert backend.unload()["gguf_variant"] is None+ # A pipeline load has no checkpoint quant to name.+ assert (+ backend.load_pipeline("Wan-AI/Wan2.2-TI2V-5B-Diffusers", model_kind = "pipeline")[+ "gguf_variant"+ ]+ is None+ )+ backend.unload()+++def test_video_status_response_carries_gguf_variant():+ from models.inference import VideoStatusResponse+ assert VideoStatusResponse(loaded = True, gguf_variant = "Q4_K_M").gguf_variant == "Q4_K_M"++def test_video_step_cache_auto_toggles_on_actual_steps(fake_runtime):# The AUTO decision follows each generation's ACTUAL step count; an explicit "off" never toggles.backend = VideoBackend()diff --git a/studio/frontend/src/features/images/api.ts b/studio/frontend/src/features/images/api.tsindex d63a955eb52..d0856361c2a 100644--- a/studio/frontend/src/features/images/api.ts+++ b/studio/frontend/src/features/images/api.ts@@ -27,6 +27,8 @@ export interface DiffusionStatus {dtype: string | null;// Resolved load kind: "gguf" | "single_file" | "pipeline". Gates GGUF-only controls. Null when not loaded.model_kind?: string | null;+ // Selected GGUF quant. Newer backends report this separately from the compute dtype.+ gguf_variant?: string | null;cpu_offload: boolean;// The ENGAGED runtime build. The backend has always sent these; declaring them is what lets the UI// report what actually ran instead of echoing the load request back at the user.diff --git a/studio/frontend/src/features/loaded-models/loaded-models-sources.ts b/studio/frontend/src/features/loaded-models/loaded-models-sources.tsindex a550a67b9f5..88036253ad6 100644--- a/studio/frontend/src/features/loaded-models/loaded-models-sources.ts+++ b/studio/frontend/src/features/loaded-models/loaded-models-sources.ts@@ -202,6 +202,10 @@ export function describeDiffusionStatus(status: DiffusionStatus | null,): LoadedModelEntry[] {if (!status?.loaded || !status.repo_id) return [];+ const isGguf =+ status.model_kind === "gguf" ||+ status.dtype?.toLowerCase() === "gguf" ||+ Boolean(status.gguf_variant);return [{id: `image:${status.repo_id}`,@@ -210,9 +214,10 @@ export function describeDiffusionStatus(name: status.repo_id,detail: joinDetail(status.family,- status.model_kind === "gguf" ? "GGUF" : null,- // A GGUF load reports "gguf" here too; joinDetail drops the repeat.- precisionLabel(status.dtype),+ isGguf ? "GGUF" : null,+ // The checkpoint quant, not dtype: dtype is the compute precision, which called+ // a Q8_0 pick BF16. Via precisionLabel so a lowercase q8_0 still reads Q8_0.+ precisionLabel(status.gguf_variant) ?? precisionLabel(status.dtype),status.device,),},@@ -231,10 +236,11 @@ export function describeVideoStatus(name: status.repo_id,detail: joinDetail(status.family,- status.model_kind === "gguf" ? "GGUF" : null,- // The dense transformer's own precision when one engaged, since that is- // what distinguishes the build; otherwise the pipeline dtype.- precisionLabel(status.transformer_quant) ??+ status.model_kind === "gguf" || status.gguf_variant ? "GGUF" : null,+ // Checkpoint quant, else the dense transformer's own precision when one+ // engaged, else the pipeline dtype (compute precision, so it called Q4_K_M BF16).+ precisionLabel(status.gguf_variant) ??+ precisionLabel(status.transformer_quant) ??precisionLabel(status.dtype),status.device,),diff --git a/studio/frontend/src/features/video/api.ts b/studio/frontend/src/features/video/api.tsindex 66c82e00874..75f11356fcc 100644--- a/studio/frontend/src/features/video/api.ts+++ b/studio/frontend/src/features/video/api.ts@@ -44,6 +44,8 @@ export interface VideoStatus {dtype: string | null;// Resolved load kind: "gguf" | "single_file" | "pipeline". Null when not loaded.model_kind?: string | null;+ // Selected GGUF quant. Newer backends report this separately from the compute dtype.+ gguf_variant?: string | null;// Resolved offload policy: none | group | model | sequential.offload_policy?: string | null;vae_tiling: boolean;diff --git a/studio/frontend/tests/loaded-models-q8-precision-repro.test.ts b/studio/frontend/tests/loaded-models-q8-precision-repro.test.tsnew file mode 100644index 00000000000..d0ab75b83a5--- /dev/null+++ b/studio/frontend/tests/loaded-models-q8-precision-repro.test.ts@@ -0,0 +1,25 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import assert from "node:assert/strict";+import test from "node:test";++import { describeDiffusionStatus } from "../src/features/loaded-models/loaded-models-sources.ts";++test("fixed: a Q8 Z-Image GGUF row names Q8 instead of its BF16 compute dtype", () => {+ const [row] = describeDiffusionStatus({+ loaded: true,+ repo_id: "unsloth/Z-Image-Turbo-GGUF",+ family: "z-image",+ device: "cuda",+ dtype: "bfloat16",+ model_kind: "gguf",+ gguf_variant: "Q8_0",+ } as never);++ assert.equal(row.detail, "z-image · GGUF · Q8_0 · cuda");+ assert.equal(row.detail.includes("BF16"), false);+ console.log(+ "PASS selected=z-image-turbo-Q8_0.gguf indicator=z-image · GGUF · Q8_0 · cuda",+ );+});diff --git a/studio/frontend/tests/loaded-models-sources.test.ts b/studio/frontend/tests/loaded-models-sources.test.tsindex e9f98ab470b..48991d63b2d 100644--- a/studio/frontend/tests/loaded-models-sources.test.ts+++ b/studio/frontend/tests/loaded-models-sources.test.ts@@ -207,6 +207,33 @@ test("a bf16 video load falls back to the pipeline dtype", () => {assert.equal(video.detail, "wan · BF16 · cuda");});+test("a GGUF video row names its selected quant instead of its compute dtype", () => {+ const [video] = describeVideoStatus({+ loaded: true,+ repo_id: "unsloth/Wan2.2-T2V-A14B-GGUF",+ family: "wan",+ model_kind: "gguf",+ gguf_variant: "Q4_K_M",+ dtype: "bfloat16",+ device: "cuda",+ } as never);+ assert.equal(video.detail, "wan · GGUF · Q4_K_M · cuda");+});++test("a lowercase quant filename still reads as an upper-case quant", () => {+ // Hub repos ship q8_0 filenames, and every other quant label in the UI is upper-cased.+ const [image] = describeDiffusionStatus({+ loaded: true,+ repo_id: "unsloth/Z-Image-Turbo-GGUF",+ family: "z-image",+ model_kind: "gguf",+ gguf_variant: "q8_0",+ dtype: "bfloat16",+ device: "cuda",+ } as never);+ assert.equal(image.detail, "z-image · GGUF · Q8_0 · cuda");+});+test("a GGUF image load does not print GGUF twice", () => {const [image] = describeDiffusionStatus({loaded: true,@@ -219,6 +246,31 @@ test("a GGUF image load does not print GGUF twice", () => {assert.equal(image.detail, "flux · GGUF · cuda");});+test("a GGUF image row names its selected quant instead of its compute dtype", () => {+ const [image] = describeDiffusionStatus({+ loaded: true,+ repo_id: "unsloth/Z-Image-Turbo-GGUF",+ family: "z-image",+ model_kind: "gguf",+ gguf_variant: "Q8_0",+ dtype: "bfloat16",+ device: "cuda",+ } as never);+ assert.equal(image.detail, "z-image · GGUF · Q8_0 · cuda");+});++test("a native GGUF image row names its selected quant without model_kind", () => {+ const [image] = describeDiffusionStatus({+ loaded: true,+ repo_id: "unsloth/Z-Image-Turbo-GGUF",+ family: "z-image",+ gguf_variant: "Q8_0",+ dtype: "gguf",+ device: "cpu",+ } as never);+ assert.equal(image.detail, "z-image · GGUF · Q8_0 · cpu");+});+// Gemma 3n and friends take audio in but answer as chat. Every backend sets// is_audio from `audio_type is not None and audio_type != "audio_vlm"`// (model_config.py, mlx_inference.py; llama_cpp.py keeps _is_audio False for