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: support llama.cpp semantic version output (#9127)
oobabooga8a3762ae57ec
diff --git a/studio/backend/tests/test_llama_cpp_update.py b/studio/backend/tests/test_llama_cpp_update.pyindex be01d8eb54a..662ce431fd9 100644--- a/studio/backend/tests/test_llama_cpp_update.py+++ b/studio/backend/tests/test_llama_cpp_update.py@@ -229,17 +229,24 @@ def test_llama_install_root_pinned_returns_none(monkeypatch, tmp_path):def test_status_source_build_suppressed_when_newer(monkeypatch, tmp_path):- # A source build already newer than the latest prebuilt is not nagged.+ # Drive the real --version parser through update status: a semantic-version+ # source build newer than the latest prebuilt must not be offered a downgrade.binary = tmp_path / "llama.cpp" / "build" / "bin" / "llama-server"binary.parent.mkdir(parents = True)binary.write_text("stub")monkeypatch.setattr(upd, "_find_binary", lambda: str(binary))- _prebuilt(monkeypatch, release_tag = "b9518")- monkeypatch.setattr(upd, "_installed_build_number", lambda b: 9600)+ _prebuilt(monkeypatch, release_tag = "b10360")++ class _Proc:+ returncode = 0+ stdout = ""+ stderr = "version: 0.1.1-dev (build 10470, commit abc1234)\n"++ monkeypatch.setattr(upd.subprocess, "run", lambda cmd, **kw: _Proc())st = upd.get_update_status()assert st["supported"] is Trueassert st["update_available"] is False- assert st["installed_tag"] == "b9600"+ assert st["installed_tag"] == "b10470"def test_status_source_build_offers_same_base_mix(monkeypatch, tmp_path):@@ -999,8 +1006,13 @@ def test_installed_build_number(monkeypatch):monkeypatch.setattr(upd.subprocess, "run", lambda cmd, **kw: _Proc())return upd._installed_build_number("/bin/llama-server")+ assert _ver("version: 0.1.1-dev (build 10470, commit abc1234)\nbuilt with clang\n") == 10470+ assert _ver("version: 0.1.1 (build 10470, commit abc1234)\n") == 10470assert _ver("version: 9585 (abc1234)\nbuilt with clang\n") == 9585+ assert _ver("version: 0.1.1-dev (build 0, commit unknown)\n") is None+ assert _ver("version: 0.1.1-dev (build 1, commit deadbee)\n") is Noneassert _ver("version: 1 (deadbee)\n") is None # source build without tags+ assert _ver("version: 2.0.0\n") is Noneassert _ver("no version here") is Noneassert upd._installed_build_number(None) is Nonediff --git a/studio/backend/utils/llama_cpp_update.py b/studio/backend/utils/llama_cpp_update.pyindex c6c31eba0cd..93e1c753d3f 100644--- a/studio/backend/utils/llama_cpp_update.py+++ b/studio/backend/utils/llama_cpp_update.py@@ -139,9 +139,13 @@ def _resolve_prebuilt_for_host(*, force_refresh: bool = False) -> Optional[dict]def _installed_build_number(binary: Optional[str]) -> Optional[int]:- """Best-effort build number from ``llama-server --version`` (e.g.- 'version: 9585 (abc)'). None when unparseable or <= 1: a source build with- no git tags reports 'version: 1', which we treat as unknown (offer update)."""+ """Best-effort build number from ``llama-server --version``.++ Current llama.cpp reports a semantic version followed by ``build NNNN``;+ older binaries put the build directly after ``version:``. None when+ unparseable or <= 1: a source build with no git tags reports build 1,+ which we treat as unknown (offer update).+ """if not binary:return Nonetry:@@ -155,7 +159,10 @@ def _installed_build_number(binary: Optional[str]) -> Optional[int]:)except Exception: # pragma: no cover - defensivereturn None- m = re.search(r"version:\s*(\d+)", (proc.stderr or "") + (proc.stdout or ""))+ output = "\n".join((proc.stderr or "", proc.stdout or ""))+ m = re.search(r"version:[^\r\n]*\bbuild\s+(\d+)\b", output)+ if not m:+ m = re.search(r"version:\s*(\d+)\b(?!\.)", output)if not m:return Nonen = int(m.group(1))@@ -215,9 +222,10 @@ def _source_build_status(binary: str, *, force_refresh: bool) -> Optional[dict]:res = _resolve_prebuilt_for_host(force_refresh = force_refresh)if not res or not res.get("prebuilt_available"):return None- # llama_tag is the upstream base (bNNNN, what --version reports); release_tag- # is the full tag, either a same-base mix (bNNNN-mix-<sha>) or a fork wrapper- # (e.g. v1.0). Compare the numeric base against llama_tag.+ # llama_tag is the upstream bNNNN base whose numeric part matches the build+ # field in --version; release_tag is the full tag, either a same-base mix+ # (bNNNN-mix-<sha>) or a fork wrapper (e.g. v1.0). Compare the numeric base+ # against llama_tag.base_tag = res.get("llama_tag") or res.get("release_tag")release_tag = res.get("release_tag")if not base_tag: