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: read a native Windows model path as one reference (#8391)
Long Yixing7abab468c12a
diff --git a/studio/backend/core/inference/openai_auto_download.py b/studio/backend/core/inference/openai_auto_download.pyindex ee1cb9de704..12b886c7076 100644--- a/studio/backend/core/inference/openai_auto_download.py+++ b/studio/backend/core/inference/openai_auto_download.py@@ -99,16 +99,17 @@ def _public_label(repo_id: str, variant: Optional[str]) -> str:def split_model_ref(requested: str) -> tuple[str, Optional[str]]:"""``org/repo:QUANT`` -> ``("org/repo", "QUANT")``; no suffix -> variant None.- Splits on the last colon. A slash-bearing suffix is only a variant when a real- Hub repo precedes it: "build/llama-13b" is a subdirectory GGUF key the catalog- advertises, while "C:/models/x.gguf" leaves a drive letter that is no repo id.+ Splits on the last colon. A suffix bearing either separator is only a variant+ when a real Hub repo precedes it: "build/llama-13b" is a subdirectory GGUF key+ the catalog advertises, while "C:/models/x.gguf" -- and the native Windows+ "C:\\models\\x.gguf" -- leaves a drive letter that is no repo id."""text = (requested or "").strip()base, sep, suffix = text.rpartition(":")if not sep or not base or not suffix:return text, Nonestripped = base.strip()- if "/" in suffix:+ if "/" in suffix.replace("\\", "/"):from hub.utils.paths import is_valid_repo_idif "/" not in stripped or not is_valid_repo_id(stripped):return text, Nonediff --git a/studio/backend/tests/test_openai_auto_download.py b/studio/backend/tests/test_openai_auto_download.pyindex 2d1984dd7e0..a869c39bd70 100644--- a/studio/backend/tests/test_openai_auto_download.py+++ b/studio/backend/tests/test_openai_auto_download.py@@ -212,6 +212,33 @@ def _run(model, hf_token = None):# Still a path, not a variant: no Hub repo precedes the colon.("/home/me/models/x:build/llama-13b", ("/home/me/models/x:build/llama-13b", None)),("D:/models/repo:build/llama-13b", ("D:/models/repo:build/llama-13b", None)),+ # A native Windows path is one reference: the drive letter is no repo id, so+ # reading the rest of the path as its variant refused a model already loaded.+ ("C:\\models\\qwen.gguf", ("C:\\models\\qwen.gguf", None)),+ ("c:\\qwen.gguf", ("c:\\qwen.gguf", None)),+ ("\\\\server\\share\\qwen.gguf", ("\\\\server\\share\\qwen.gguf", None)),+ # A quant still pins one, on either spelling of the path.+ ("C:\\models\\qwen.gguf:Q4_K_M", ("C:\\models\\qwen.gguf", "Q4_K_M")),+ ("C:/models/qwen.gguf:Q4_K_M", ("C:/models/qwen.gguf", "Q4_K_M")),+ ("\\\\server\\share\\qwen.gguf:Q4_K_M", ("\\\\server\\share\\qwen.gguf", "Q4_K_M")),+ # A backslash-qualified variant key still parses behind a real Hub repo.+ ("org/repo:build\\model.gguf", ("org/repo", "build\\model.gguf")),+ ("D:\\models\\repo:build\\llama-13b", ("D:\\models\\repo:build\\llama-13b", None)),+ # Extended-length and device-namespace prefixes, used past MAX_PATH.+ ("\\\\?\\C:\\models\\qwen.gguf", ("\\\\?\\C:\\models\\qwen.gguf", None)),+ ("\\\\.\\C:\\models\\qwen.gguf", ("\\\\.\\C:\\models\\qwen.gguf", None)),+ ("\\\\?\\C:\\models\\qwen.gguf:UD-Q4_K_XL", ("\\\\?\\C:\\models\\qwen.gguf", "UD-Q4_K_XL")),+ # Drive-relative: no separator after the colon at all.+ ("C:models\\x.gguf", ("C:models\\x.gguf", None)),+ # Mixed separators, and the bare drive root.+ ("C:/models\\x.gguf", ("C:/models\\x.gguf", None)),+ ("C:\\models/x.gguf", ("C:\\models/x.gguf", None)),+ ("C:\\", ("C:\\", None)),+ # An admin UNC share.+ ("\\\\server\\share$\\qwen.gguf", ("\\\\server\\share$\\qwen.gguf", None)),+ # An Ollama tag must still split, or a foreign id starts being served locally.+ ("name:latest", ("name", "latest")),+ ("llama3:8b", ("llama3", "8b")),],)def test_split_model_ref(raw, expected):@@ -1178,6 +1205,18 @@ def test_an_ollama_tag_still_matches_the_resident_gguf(monkeypatch):assert inference_route._loaded_satisfies("unsloth/A-GGUF:Q8_0") is False+def test_a_windows_path_matches_the_gguf_loaded_from_it(monkeypatch):+ # The drive letter read as the repo and the rest of the path as an explicit quant, so a+ # model loaded from that path never matched its own name and the call was refused instead.+ loaded = _Loaded("C:\\models\\qwen.gguf", "Q4_K_M")+ monkeypatch.setattr(inference_route, "get_llama_cpp_backend", lambda: loaded)+ assert inference_route._loaded_satisfies("C:\\models\\qwen.gguf") is True+ # Either spelling of the same path names the same weights.+ assert inference_route._loaded_satisfies("C:/models/qwen.gguf") is True+ assert inference_route._loaded_satisfies("C:\\models\\qwen.gguf:Q4_K_M") is True+ assert inference_route._loaded_satisfies("C:\\models\\qwen.gguf:Q8_0") is False++def test_a_probing_adoption_never_releases_the_slot(hub, monkeypatch):# The whole-repo job key can hold a stale error that would free the probe's slot.hub["on_probe"] = lambda: _run_nested()