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
Fix llama.cpp prebuilt: skip already-installed same-release fallback (#6285)
Daniel Hana8af0a1a4f94
diff --git a/studio/install_llama_prebuilt.py b/studio/install_llama_prebuilt.pyindex 46aa14b0412..aab6d641fe5 100644--- a/studio/install_llama_prebuilt.py+++ b/studio/install_llama_prebuilt.py@@ -6436,13 +6436,19 @@ def validate_prebuilt_attempts(f"runtime_line={attempt.runtime_line} coverage_class={attempt.coverage_class}")- if existing_install_dir is not None and existing_install_matches_choice(- existing_install_dir,- host,- llama_tag = llama_tag,- release_tag = release_tag,- choice = attempt,- approved_checksums = approved_checksums,+ if (+ existing_install_dir is not None+ and existing_install_matches_choice(+ existing_install_dir,+ host,+ llama_tag = llama_tag,+ release_tag = release_tag,+ choice = attempt,+ approved_checksums = approved_checksums,+ )+ # Skip a matching candidate unless it still needs the DiffusionGemma+ # backfill re-extract (gated per-attempt, not per-plan).+ and not diffusion_visual_server_backfill_needed(existing_install_dir, host, attempt)):log("existing llama.cpp install already matches fallback candidate "@@ -6601,9 +6607,8 @@ def install_prebuilt(release_tag = plan.release_tag,approved_checksums = plan.approved_checksums,initial_fallback_used = release_index > 0,- # a backfill must reinstall, so do not let the inner- # existing-install match short-circuit the re-extract- existing_install_dir = None if backfill else install_dir,+ # Skip is gated per-attempt inside, so pass the dir always.+ existing_install_dir = install_dir,)except ExistingInstallSatisfied:returndiff --git a/tests/test_studio_install_workspace_guard.py b/tests/test_studio_install_workspace_guard.pyindex 7d93645ca99..27035b522d2 100644--- a/tests/test_studio_install_workspace_guard.py+++ b/tests/test_studio_install_workspace_guard.py@@ -873,15 +873,20 @@ def test_llama_cpp_search_roots_handles_studio_root_oserror():llama_cpp = (REPO_ROOT / "studio" / "backend" / "core" / "inference" / "llama_cpp.py").read_text()- find_block_start = llama_cpp.index("_find_llama_server_binary")- find_block = llama_cpp[find_block_start : find_block_start + 4000]- assert (- "except (ImportError, OSError, ValueError):" in find_block++ def _method_body(name: str) -> str:+ # Whole method body (def to next sibling def), so the check survives the+ # function growing past any fixed-size window.+ start = llama_cpp.index(f"def {name}")+ indent = " " * (start - llama_cpp.rfind("\n", 0, start) - 1)+ nxt = llama_cpp.find(f"\n{indent}def ", start + 1)+ return llama_cpp[start : nxt if nxt != -1 else len(llama_cpp)]++ assert "except (ImportError, OSError, ValueError):" in _method_body(+ "_find_llama_server_binary"), "_find_llama_server_binary must catch (ImportError, OSError, ValueError) from studio_root()"- kill_def_idx = llama_cpp.index("def _kill_orphaned_servers")- kill_block = llama_cpp[kill_def_idx : kill_def_idx + 4000]- assert (- "except (ImportError, OSError, ValueError):" in kill_block+ assert "except (ImportError, OSError, ValueError):" in _method_body(+ "_kill_orphaned_servers"), "sibling _kill_orphaned_servers must keep its (ImportError, OSError, ValueError) handler"