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(studio): wire llama's OpenMP runtime into slim whisper installs (#8230)
Daniel Han954468a3cb8c
diff --git a/studio/backend/core/inference/stt_ggml_sidecar.py b/studio/backend/core/inference/stt_ggml_sidecar.pyindex 7dfa8c54358..383f06b740c 100644--- a/studio/backend/core/inference/stt_ggml_sidecar.py+++ b/studio/backend/core/inference/stt_ggml_sidecar.py@@ -244,8 +244,12 @@ def slim_runtime_intact(binary: str) -> bool:)if intact and marker.get("backend") == "rocm":expected_runtime_dirs = set() if sys.platform == "win32" else {"hipblaslt", "rocblas"}+ # Any wiring from version 2 on records linked_runtime_directories, so+ # pin the floor, not one version, or an installer bump strands installs.+ wiring_version = marker.get("runtime_wiring_version")intact = (- marker.get("runtime_wiring_version") == 2+ isinstance(wiring_version, int)+ and wiring_version >= 2and isinstance(runtime_dirs, list)and set(runtime_dirs) == expected_runtime_dirs)diff --git a/studio/backend/tests/test_stt_ggml_sidecar.py b/studio/backend/tests/test_stt_ggml_sidecar.pyindex 686fd8f546f..b2cf43e5cd9 100644--- a/studio/backend/tests/test_stt_ggml_sidecar.py+++ b/studio/backend/tests/test_stt_ggml_sidecar.py@@ -255,6 +255,35 @@ def test_slim_guard_rejects_missing_rocm_catalog(tmp_path):assert ggml_module.slim_runtime_intact(binary) is False+def test_slim_guard_accepts_newer_rocm_wiring_version(tmp_path):+ # The guard pins a floor, not one version: an installer bump must not strand+ # ROCm installs as unavailable when every wired library is present.+ names = ["libggml.so.0", "libggml-base.so.0", "libggml-hip.so"]+ binary = _slim_install(+ tmp_path,+ linked_libraries = names,+ backend = "rocm",+ linked_runtime_directories = ["hipblaslt", "rocblas"],+ runtime_wiring_version = 3,+ )+ (Path(binary).parent / "libggml-hip.so").write_bytes(b"ggml")+ assert ggml_module.slim_runtime_intact(binary) is True+++def test_slim_guard_rejects_pre_catalog_rocm_wiring_version(tmp_path):+ # Version 1 predates linked_runtime_directories, so it stays rejected.+ names = ["libggml.so.0", "libggml-base.so.0", "libggml-hip.so"]+ binary = _slim_install(+ tmp_path,+ linked_libraries = names,+ backend = "rocm",+ linked_runtime_directories = ["hipblaslt", "rocblas"],+ runtime_wiring_version = 1,+ )+ (Path(binary).parent / "libggml-hip.so").write_bytes(b"ggml")+ assert ggml_module.slim_runtime_intact(binary) is False++def test_slim_guard_accepts_windows_rocm_dll_overlay(monkeypatch, tmp_path):monkeypatch.setattr(ggml_module.sys, "platform", "win32")names = ["ggml.dll", "ggml-base.dll", "ggml-hip.dll", "amdhip64.dll"]diff --git a/studio/install_whisper_prebuilt.py b/studio/install_whisper_prebuilt.pyindex 3c2215e31f5..6282aa98092 100644--- a/studio/install_whisper_prebuilt.py+++ b/studio/install_whisper_prebuilt.py@@ -166,12 +166,18 @@ SLIM_BACKEND_MODULE_GLOBS = {# Everything the slim wiring mirrors from the llama bin dir: the core ggml# sonames plus every dlopen'd backend module (CPU variants included). libggml*-# matches .so and .dylib alike; ggml*.dll covers Windows. libomp*.dll rides along-# because llama's clang-built windows-arm64 ggml-base.dll imports-# libomp140.aarch64.dll, shipped in the llama bundle but never a system DLL, so-# the loader needs it next to whisper-server.exe (MSVC x64 uses System32-# vcomp140.dll; Linux ggml needs system libgomp.so.1, which llama already requires).-SLIM_GGML_LIBRARY_GLOBS = ("libggml*", "ggml*.dll", "libomp*.dll")+# matches .so and .dylib alike; ggml*.dll covers Windows. libomp* rides along+# because llama's clang-built slices (windows x64/arm64, linux arm64) link ggml+# against the LLVM OpenMP runtime and ship it in the bundle, so the loader can+# never find it on the host. Linux x64 (gcc, host libgomp.so.1) and macOS (Apple+# clang, no OpenMP) ship none, so the globs match nothing there.+SLIM_GGML_LIBRARY_GLOBS = (+ "libggml*",+ "ggml*.dll",+ "libomp*.dll",+ "libomp*.so*",+ "libomp*.dylib",+)SLIM_ROCM_LIBRARY_GLOBS = ("libamd*.so*","libhip*.so*",@@ -179,7 +185,9 @@ SLIM_ROCM_LIBRARY_GLOBS = ("libroc*.so*",)SLIM_ROCM_RUNTIME_DIRS = ("hipblaslt", "rocblas")-SLIM_RUNTIME_WIRING_VERSION = 2+# 3: libomp*.so*/dylib joined the wiring, so version 2 installs are missing+# libomp.so.5 on linux arm64 and must re-wire.+SLIM_RUNTIME_WIRING_VERSION = 3INSTALL_STAGING_ROOT_NAME = ".staging"diff --git a/tests/studio/install/test_install_whisper_prebuilt_logic.py b/tests/studio/install/test_install_whisper_prebuilt_logic.pyindex 9d8989c24bf..0eba6e265f9 100644--- a/tests/studio/install/test_install_whisper_prebuilt_logic.py+++ b/tests/studio/install/test_install_whisper_prebuilt_logic.py@@ -988,6 +988,36 @@ def test_link_ggml_runtime_wires_windows_libomp(tmp_path):assert not (whisper_bin / "llama.dll").exists()+def test_link_ggml_runtime_wires_linux_libomp(tmp_path):+ # llama's clang-built linux-arm64 libggml-base.so NEEDS libomp.so.5, bundled+ # and never on the host: without it whisper-server fails to load.+ bin_dir = tmp_path / "llama_bin"+ bin_dir.mkdir()+ for name in ("libggml.so.0", "libggml-base.so.0", "libggml-cpu-armv8.0_1.so", "libomp.so.5"):+ (bin_dir / name).write_bytes(b"x")+ (bin_dir / "libllama.so").write_bytes(b"x") # never wired+ whisper_bin = tmp_path / "whisper_bin"+ linked = M.link_ggml_runtime(bin_dir, whisper_bin)+ assert linked == [+ "libggml-base.so.0",+ "libggml-cpu-armv8.0_1.so",+ "libggml.so.0",+ "libomp.so.5",+ ]+ assert (whisper_bin / "libomp.so.5").is_file()+ assert not (whisper_bin / "libllama.so").exists()+++def test_link_ggml_runtime_linux_libomp_alone_is_not_a_pairing(tmp_path):+ # Same fail-closed rule as the Windows case: OpenMP without ggml is not a+ # usable llama runtime.+ bin_dir = tmp_path / "llama_bin"+ bin_dir.mkdir()+ (bin_dir / "libomp.so.5").write_bytes(b"x")+ with pytest.raises(PrebuiltFallback):+ M.link_ggml_runtime(bin_dir, tmp_path / "whisper_bin")++def test_rocm_runtime_wires_complete_windows_dll_overlay(tmp_path):bin_dir = tmp_path / "llama_bin"bin_dir.mkdir()