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: do not download PyTorch Clef for an over-long decision request (#16509)
Nilaya970757b5cbc
diff --git a/studio/backend/core/systemone/laya_runtime.py b/studio/backend/core/systemone/laya_runtime.pyindex 6d4af4ac051..002f8f11b3f 100644--- a/studio/backend/core/systemone/laya_runtime.py+++ b/studio/backend/core/systemone/laya_runtime.py@@ -2282,7 +2282,7 @@ def _route(try:return _decide(target, state, questions, images, audio)except NativeContextOverflow as exc:- # Auto answers on PyTorch only what its longer window can hold; at equal windows it would refuse too.+ # Auto answers on PyTorch only what its longer window can hold, and only from a download already made.from .catalog import clef_unsupported_reasonif (@@ -2291,6 +2291,7 @@ def _route(or imagesor exc.limit >= MAX_LENGTHor clef_unsupported_reason() is not None+ or not is_cached(checkpoint)):raise Unavailable(422, "invalid_request_error", str(exc)) from None_fallback_reason = "The request is longer than the llama.cpp context."diff --git a/studio/backend/tests/test_decision_native.py b/studio/backend/tests/test_decision_native.pyindex dd459326e2f..e5ab610f285 100644--- a/studio/backend/tests/test_decision_native.py+++ b/studio/backend/tests/test_decision_native.py@@ -796,6 +796,28 @@ def test_auto_retries_an_over_long_state_on_pytorch_only_when_it_is_longer(assert home.torch_agents == []+def test_auto_refuses_an_over_long_state_when_pytorch_is_not_downloaded(+ home, client, stub, monkeypatch+):+ downloads = []++ def not_downloaded(checkpoint, local_only):+ if not local_only:+ downloads.append(checkpoint.name)+ raise FileNotFoundError(checkpoint.name)++ monkeypatch.setattr(laya_runtime, "_clef_dir", not_downloaded)+ _cache_gguf(home.cache)+ _put(client, enabled = True, model = "clef-flash", native_ctx = 1024)+ response = _post(client, state = "word " * 1100)+ if laya_runtime._loader is not None:+ laya_runtime._loader.join(5)+ assert response.status_code == 422 and "at most 1024" in response.json()["detail"]["message"]+ assert downloads == [] and home.torch_agents == []+ assert _post(client).headers["x-unsloth-decision-backend"] == "llama.cpp"+ assert len(stub.records("start")) == 1++def test_other_native_failures_are_surfaced_not_retried(home, client, stub):_cache_gguf(home.cache)_put(client, enabled = True, model = "clef-flash")