Skip to content

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.

Check the GGUF load marker on load_model through the AST (#15017)

Daniel Han8373f09d9ab6
diff --git a/studio/backend/tests/test_gguf_load_cache_reuse.py b/studio/backend/tests/test_gguf_load_cache_reuse.py
index c08d1be88ac..7edac5b0d11 100644
--- a/studio/backend/tests/test_gguf_load_cache_reuse.py
+++ b/studio/backend/tests/test_gguf_load_cache_reuse.py
@@ -5,6 +5,7 @@
from __future__ import annotations
+import ast
import asyncio
import importlib.util
import logging
@@ -1465,7 +1466,16 @@ class TestLoadHubDownloadExclusion:
llama_source = (
Path(__file__).resolve().parent.parent / "core" / "inference" / "llama_cpp.py"
).read_text(encoding = "utf-8")
- assert "@_with_gguf_load_marker\n def load_model(" in llama_source
+ # Any position in the stack (#14546 put @holds_inference under it); the marker must wrap load_model.
+ loads = [
+ node
+ for cls in ast.parse(llama_source).body
+ if isinstance(cls, ast.ClassDef) and cls.name == "LlamaCppBackend"
+ for node in cls.body
+ if isinstance(node, ast.FunctionDef) and node.name == "load_model"
+ ]
+ assert len(loads) == 1
+ assert "_with_gguf_load_marker" in [ast.unparse(d) for d in loads[0].decorator_list]
def _capture_hub_guard_require_mmproj(
self,