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: realign the image precision contracts with the fail-closed refusal (#8257)
Daniel Hand9c15f692991
diff --git a/studio/backend/tests/test_diffusion_backend.py b/studio/backend/tests/test_diffusion_backend.pyindex 7b3e05a4c9f..4ff011b9c1d 100644--- a/studio/backend/tests/test_diffusion_backend.py+++ b/studio/backend/tests/test_diffusion_backend.py@@ -2813,6 +2813,7 @@ def test_load_refines_component_placement_after_text_encoder_quantization(fake_runtime, tmp_path, monkeypatch):from core.inference import diffusion as dmod+ from core.inference.diffusion_precision import TEQuantOutcome(tmp_path / "m.gguf").write_bytes(b"x")backend = DiffusionBackend()@@ -2821,7 +2822,10 @@ def test_load_refines_component_placement_after_text_encoder_quantization(def _quantize(*args, **kwargs):seen["quantized"] = True- return None+ # The real pass reports what it did and the loader reads `.mode` off that report, so a+ # bare None here is a shape the production function can no longer return. A None mode+ # keeps this stub's meaning: the encoders were left dense.+ return TEQuantOutcome(None)def _refine(pipe, plan):assert seen["quantized"] is Truediff --git a/studio/backend/tests/test_saved_image_metadata_precision_contract.py b/studio/backend/tests/test_saved_image_metadata_precision_contract.pyindex 09b18366aa7..d4bb6bac293 100644--- a/studio/backend/tests/test_saved_image_metadata_precision_contract.py+++ b/studio/backend/tests/test_saved_image_metadata_precision_contract.py@@ -265,6 +265,10 @@ def test_a_declined_quant_request_is_not_reported_as_engaged():"""The user asked for fp8; the host has no dense source, so the GGUF loaded as-is.The recipe must say "GGUF, no quant", not "fp8"."""+ # A declined explicit precision now refuses the load outright unless the fallback is opted+ # into. This contract is about what the recipe records for a build that DID fall back, so it+ # has to ask for that build, the same way the routes and backend suites do.+ monkeypatch.setenv("UNSLOTH_DIFFUSION_ALLOW_PRECISION_FALLBACK", "1")monkeypatch.setattr(diffusion_module, "dense_transformer_supported", lambda target: False)status = _load(backend, tmp_path, monkeypatch, stub_runtime, transformer_quant = "fp8")@@ -274,7 +278,9 @@ def test_a_declined_quant_request_is_not_reported_as_engaged(# request was explicit, the engaged value is "off".resolved = status["resolved"]["transformer_quant"]assert resolved["value"] == "off" and resolved["source"] == "explicit"- assert "GGUF transformer loaded" in resolved["reason"]+ # The reason now names why the request was declined rather than what loaded in its place,+ # which is the half a user can act on. The substantive contract is the pair above.+ assert "dense torchao quant" in resolved["reason"]result = _generate(backend)assert result["transformer_quant"] is None, (@@ -352,6 +358,11 @@ class _EngagedBackend:def preflight_base_access(self, model_path, fam, **kwargs):return None+ def assert_precision_available(self, fam, **kwargs) -> None:+ # The route's pre-eviction refusal for a precision this host can never honor. This+ # backend exists to ENGAGE one, so it has nothing to refuse.+ return None+def begin_load(self, model_path, **kwargs):self.loaded = Trueself.last_load_kwargs = dict(kwargs)