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: serve the Decision API's pinned GGUFs from their ModelScope commits (#16285)
Debojyoti Banerjee4348ac8c09c4
diff --git a/studio/backend/hub/modelscope/upstream.py b/studio/backend/hub/modelscope/upstream.pyindex 30813b86983..da6dc711599 100644--- a/studio/backend/hub/modelscope/upstream.py+++ b/studio/backend/hub/modelscope/upstream.py@@ -67,6 +67,56 @@ _PINNED_COMMITS = {"ibm-research/dac.speech.v1.0","1ea7f64cd0678415e2d8c32d67b190722cb9b149",): "3268c083add6c07ae3c4a36650863eb2c3bb6717",+ (+ "model",+ "ggml-org/clef-flash-gguf",+ "4a192915ef971886004b5b13294f2b4c7a7fc39d",+ ): "7b759102aa09974f325b52ee533bbbd47126c87b",+ (+ "model",+ "ggml-org/clef-gguf",+ "63840a1a68cb7084c88610cffc328509356b04cb",+ ): "9680d82742044d42d2e77fc4d1a915454e313955",+ (+ "model",+ "ggml-org/kev-0.8b-gguf",+ "e551e319d483ff57e1ff208924b349d397cffc1c",+ ): "9b1e85197d3a20c2e37fa9ac804b9bbfe2a3e392",+ (+ "model",+ "ggml-org/kev-4b-gguf",+ "d924f2e2c3872da8b8aaf3eb4453b4126deceb79",+ ): "444aa7a51432034cc45eda7733f0dab31319b0b3",+ (+ "model",+ "ggml-org/kev-9b-gguf",+ "ec2bbfe6620218aee2e01cc93bb78dee2a96ed58",+ ): "1910374c3e4fbec4e5ce4da7453df3f2b4aa91ad",+ (+ "model",+ "ggml-org/lev-gguf",+ "3e9286a79ae857b4e1de051c92fab6dc574581ce",+ ): "ddc329eeb7f1d073d692c3e63b53f883c4a36884",+ (+ "model",+ "ggml-org/bespoke-nimble-9b-v3-gguf",+ "a72bdbadb355ca3014f7f9d2585380917cc59971",+ ): "39398e9f18dd1268181a0e55aa93015303a3fe0f",+ (+ "model",+ "ggml-org/openjev-gguf",+ "10840f375658dea7afc5ff4711127bca8218b560",+ ): "0e92bdc0c205913a707db422da43a12914078026",+ (+ "model",+ "ggml-org/laya-gguf",+ "22265007700297ba9e128297e82540cf28c5d7d4",+ ): "968a9847e6f99bdc1440441cdb352635e5a68121",+ (+ "model",+ "ggml-org/julia-1-gguf",+ "16fee17949206fbf58da9347daea44d792a81211",+ ): "75a35d1ee9701238e520fce8a3c8c5a546f63c65",}@@ -236,6 +286,16 @@ async def resolve_revision(kind: str, repo: str, revision: str) -> str:return sha+async def _listing_missing(kind: str, repo: str, sha: str) -> NotFound:+ # ModelScope answers an unknown commit of a real repo with the same 404 as a missing repo.+ await _refs(kind, repo)+ return NotFound(+ "RevisionNotFound",+ f"ModelScope's copy of {repo} has no commit {sha}. "+ "Switch the model source to Hugging Face in Settings to use this revision.",+ )++async def _file_entries(kind: str, repo: str, sha: str) -> list[dict]:source = upstream_id(kind, repo)if kind == "model":@@ -243,7 +303,7 @@ async def _file_entries(kind: str, repo: str, sha: str) -> list[dict]:f"/api/v1/models/{source}/repo/files", {"Revision": sha, "Recursive": "true"})if data is None:- raise repo_missing(repo)+ raise await _listing_missing(kind, repo, sha)return (data.get("Data") or {}).get("Files") or []entries: list[dict] = []for page in range(1, _TREE_MAX_PAGES + 1):@@ -258,7 +318,7 @@ async def _file_entries(kind: str, repo: str, sha: str) -> list[dict]:},)if data is None:- raise repo_missing(repo)+ raise await _listing_missing(kind, repo, sha)batch = (data.get("Data") or {}).get("Files") or []entries.extend(batch)if len(batch) < _TREE_PAGE:diff --git a/studio/backend/tests/test_modelscope_hub.py b/studio/backend/tests/test_modelscope_hub.pyindex 4be9373ba6e..89edebb346f 100644--- a/studio/backend/tests/test_modelscope_hub.py+++ b/studio/backend/tests/test_modelscope_hub.py@@ -27,6 +27,7 @@ from hub.modelscope.router import build_routerSHA = "a" * 40TAG = "b" * 40+GONE = "f" * 40def _pkt(line: str) -> bytes:@@ -73,6 +74,8 @@ def _upstream(request: httpx.Request) -> httpx.Response:return httpx.Response(200, content = REFS)if path.endswith(".git/info/refs"):return httpx.Response(500 if "boom" in path else 404)+ if request.url.params.get("Revision") == GONE:+ return httpx.Response(404)if path == "/api/v1/models/Qwen/Tiny/repo/files":return httpx.Response(200, json = {"Data": {"Files": MODEL_FILES}})if path == "/api/v1/datasets/org/ds/repo/tree":@@ -268,6 +271,37 @@ def test_every_error_reader_names_a_repo_missing_on_modelscope(hub, monkeypatch)assert modelscope_missing(lost, "org/ds") == not_on_modelscope("org/ds")+def test_a_commit_modelscope_lacks_is_a_missing_revision_not_a_missing_repo(hub):+ from huggingface_hub.errors import RevisionNotFoundError+ from huggingface_hub.utils import _http as hf_http, hf_raise_for_status+ from hub.utils.hf_errors import modelscope_missing++ for path in (+ f"/Qwen/Tiny/resolve/{GONE}/config.json",+ f"/api/models/Qwen/Tiny/revision/{GONE}",+ f"/api/datasets/org/ds/tree/{GONE}",+ ):+ answer = hub.head(path) if "/resolve/" in path else hub.get(path)+ assert (answer.status_code, answer.headers["x-error-code"]) == (404, "RevisionNotFound")+ response = hf_http.httpx.Response(+ answer.status_code,+ headers = answer.headers,+ content = answer.content,+ request = hf_http.httpx.Request("GET", str(answer.url)),+ )+ missing = pytest.raises(RevisionNotFoundError, hf_raise_for_status, response)+ assert modelscope_missing(missing.value) is None+ gone = hub.get(f"/api/models/no/one/revision/{GONE}")+ assert (gone.status_code, gone.headers["x-error-code"]) == (404, "RepoNotFound")+++def test_every_decision_gguf_pin_has_its_modelscope_commit():+ from core.systemone.catalog import GGUF_COMPANIONS+ for name, companion in GGUF_COMPANIONS.items():+ mapped = upstream.upstream_commit("model", companion.repo, companion.revision)+ assert mapped != companion.revision, f"{name}: add its ModelScope commit to _PINNED_COMMITS"++def test_writes_bad_ids_and_upstream_failures(hub):assert hub.post("/api/repos/create", json = {}).status_code == 403assert hub.get("/api/models/a/b..c").status_code == 400