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
Studio: name the quant a diffusion GGUF pick actually loaded (#8241)
Daniel Hanf21b04c58e13
diff --git a/studio/backend/tests/test_diffusion_backend.py b/studio/backend/tests/test_diffusion_backend.pyindex 4ff011b9c1d..2a4bd9e8183 100644--- a/studio/backend/tests/test_diffusion_backend.py+++ b/studio/backend/tests/test_diffusion_backend.py@@ -4524,6 +4524,49 @@ def test_dense_quant_prefetch_declines_with_the_load(fake_runtime, monkeypatch):assert len(consulted) == 2+def test_status_names_the_gguf_quant_that_actually_ran(fake_runtime, tmp_path):+ # The reported bug: picking a GGUF at Q8_0 showed "BF16" in the loaded models row, because+ # dtype is the pipeline COMPUTE dtype and reads bf16 for every CUDA load. gguf_variant is+ # what distinguishes the file that was downloaded and opened.+ backend = DiffusionBackend()+ (tmp_path / "z-image-turbo-Q8_0.gguf").write_bytes(b"x")+ backend.load_pipeline(+ str(tmp_path),+ gguf_filename = "z-image-turbo-Q8_0.gguf",+ family_override = "z-image",+ )+ status = backend.status()+ assert status["model_kind"] == "gguf"+ assert status["transformer_quant"] is None # the GGUF ran as-is+ assert status["gguf_variant"] == "Q8_0"+++def test_status_reports_the_dense_build_when_it_replaced_the_gguf(+ fake_runtime, tmp_path, monkeypatch+):+ # A GGUF pick the dense fast path took over denoises with a torchao build of the BASE+ # transformer, and the .gguf on disk is never opened. transformer_quant is what describes+ # that build, so the row must prefer it over the picked file's quant.+ backend = DiffusionBackend()+ _force_cuda_target(backend, monkeypatch)+ _stub_dense_quant(monkeypatch, scheme = "fp8")+ (tmp_path / "z-image-turbo-Q8_0.gguf").write_bytes(b"x")+ status = backend.load_pipeline(+ str(tmp_path),+ gguf_filename = "z-image-turbo-Q8_0.gguf",+ family_override = "z-image",+ transformer_quant = "fp8",+ )+ assert status["transformer_quant"] == "fp8"+ assert backend.status()["transformer_quant"] == "fp8"+++def test_status_carries_no_gguf_variant_when_nothing_is_loaded():+ # The unloaded payload must declare every key the loaded one does, or the row keeps the+ # previous model's quant after an eject.+ assert DiffusionBackend().status()["gguf_variant"] is None++def test_diffusion_status_response_carries_resolved():# The backend records per-control auto-policy provenance on state.resolved, so the response model must declare the field or Pydantic drops it.from models.inference import DiffusionStatusResponsediff --git a/studio/frontend/src/features/loaded-models/loaded-models-sources.ts b/studio/frontend/src/features/loaded-models/loaded-models-sources.tsindex 88036253ad6..0f76ddf54a8 100644--- a/studio/frontend/src/features/loaded-models/loaded-models-sources.ts+++ b/studio/frontend/src/features/loaded-models/loaded-models-sources.ts@@ -184,9 +184,10 @@ export function describeInferenceStatus(}/**- * The precision a pipeline actually loaded at, short enough for the row. Images- * report a torch dtype, video a resolved quantisation ("none" being plain- * bf16). Anything unrecognised is shown as the backend spelled it, upper-cased.+ * The precision a pipeline actually loaded at, short enough for the row. Fed a+ * torch dtype, a resolved quantisation ("none" being plain bf16) or a GGUF quant+ * token. Anything unrecognised is shown as the backend spelled it, upper-cased,+ * which is what keeps "Q8_0" and "IQ4_XS" readable without a table per quant.*/export function precisionLabel(value: string | null | undefined): string | null {if (!value || value === "none") return null;@@ -214,10 +215,17 @@ export function describeDiffusionStatus(name: status.repo_id,detail: joinDetail(status.family,- 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),+ // Only while the GGUF is what ran. A GGUF pick the dense fast path replaced is a+ // torchao build of the base transformer, and calling that row "GGUF" names a file+ // the pipeline never opened.+ isGguf && !status.transformer_quant ? "GGUF" : null,+ // What the transformer IS, in the order the build decides it: the dense scheme when+ // one engaged, else the quant of the GGUF that ran, else the pipeline dtype. `dtype`+ // is a COMPUTE dtype and reads bf16 for every CUDA load, so on its own it reported+ // "BF16" for a Q8_0 pick. Via precisionLabel so a lowercase q8_0 still reads Q8_0.+ precisionLabel(status.transformer_quant) ??+ precisionLabel(status.gguf_variant) ??+ precisionLabel(status.dtype),status.device,),},diff --git a/studio/frontend/tests/loaded-models-backcompat.test.ts b/studio/frontend/tests/loaded-models-backcompat.test.tsindex ba54107855d..4b73c9ae904 100644--- a/studio/frontend/tests/loaded-models-backcompat.test.ts+++ b/studio/frontend/tests/loaded-models-backcompat.test.ts@@ -178,6 +178,20 @@ test("fields a future backend adds are ignored, not rendered", () => {assert.equal(rows[0].detail, "flux · BF16 · cuda");});+test("a backend with no gguf_variant field still reports the compute dtype", () => {+ // gguf_variant is additive. An older wheel sends model_kind but not the quant, and the row must+ // keep the line it has always shown rather than losing its precision part entirely.+ const rows = describeDiffusionStatus({+ loaded: true,+ repo_id: "unsloth/Z-Image-Turbo-GGUF",+ family: "z-image",+ model_kind: "gguf",+ dtype: "bfloat16",+ device: "cuda",+ } as never);+ assert.equal(rows[0].detail, "z-image · GGUF · BF16 · cuda");+});+test("an unrecognised precision is passed through rather than dropped", () => {// precisionLabel upper-cases anything it does not know, so a quant added// later still tells the user something instead of vanishing.diff --git a/studio/frontend/tests/loaded-models-sources.test.ts b/studio/frontend/tests/loaded-models-sources.test.tsindex 48991d63b2d..eae093340a1 100644--- a/studio/frontend/tests/loaded-models-sources.test.ts+++ b/studio/frontend/tests/loaded-models-sources.test.ts@@ -246,20 +246,26 @@ 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", () => {+test("a GGUF image row names the quant that was picked, not the compute dtype", () => {+ // The reported bug: the picker chip said "GGUF \u00b7 Q8_0" and the row beside it said "BF16",+ // because `dtype` is the pipeline COMPUTE dtype and reads bf16 for every CUDA load. The+ // quant is what distinguishes the file that was downloaded and opened.const [image] = describeDiffusionStatus({loaded: true,repo_id: "unsloth/Z-Image-Turbo-GGUF",family: "z-image",model_kind: "gguf",gguf_variant: "Q8_0",+ transformer_quant: null,dtype: "bfloat16",device: "cuda",} as never);- assert.equal(image.detail, "z-image · GGUF · Q8_0 · cuda");+ assert.equal(image.detail, "z-image \u00b7 GGUF \u00b7 Q8_0 \u00b7 cuda");});test("a native GGUF image row names its selected quant without model_kind", () => {+ // The sd.cpp engine reports dtype "gguf" and no model_kind, so the GGUF chip and the quant+ // both have to survive on that field alone.const [image] = describeDiffusionStatus({loaded: true,repo_id: "unsloth/Z-Image-Turbo-GGUF",@@ -268,7 +274,23 @@ test("a native GGUF image row names its selected quant without model_kind", () =dtype: "gguf",device: "cpu",} as never);- assert.equal(image.detail, "z-image · GGUF · Q8_0 · cpu");+ assert.equal(image.detail, "z-image \u00b7 GGUF \u00b7 Q8_0 \u00b7 cpu");+});++test("a GGUF pick the dense fast path replaced names that build instead", () => {+ // The fast path denoises with a torchao build of the base transformer and never opens the+ // .gguf, so the row must neither call it GGUF nor print a quant no tensor carries.+ const [image] = describeDiffusionStatus({+ loaded: true,+ repo_id: "unsloth/Z-Image-Turbo-GGUF",+ family: "z-image",+ model_kind: "gguf",+ gguf_variant: "Q8_0",+ transformer_quant: "fp8",+ dtype: "bfloat16",+ device: "cuda",+ } as never);+ assert.equal(image.detail, "z-image \u00b7 FP8 \u00b7 cuda");});// Gemma 3n and friends take audio in but answer as chat. Every backend sets