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.

Auto-download mmproj for vision-capable GGUF models

Daniel Han39854f44292d
diff --git a/studio/backend/core/inference/llama_cpp.py b/studio/backend/core/inference/llama_cpp.py
index 3ed4589dc02..f20a4fbe10e 100644
--- a/studio/backend/core/inference/llama_cpp.py
+++ b/studio/backend/core/inference/llama_cpp.py
@@ -535,6 +535,48 @@ class LlamaCppBackend:
logger.info(f"GGUF downloaded to: {local_path}")
return local_path
+ def _download_mmproj(
+ self,
+ *,
+ hf_repo: str,
+ hf_token: Optional[str] = None,
+ ) -> Optional[str]:
+ """Download the mmproj (vision projection) file from a GGUF repo.
+
+ Prefers mmproj-F16.gguf, falls back to any mmproj*.gguf file.
+ Returns the local path, or None if no mmproj file exists.
+ """
+ try:
+ from huggingface_hub import hf_hub_download, list_repo_files
+
+ files = list_repo_files(hf_repo, token = hf_token)
+ mmproj_files = sorted(
+ f for f in files
+ if f.endswith(".gguf") and "mmproj" in f.lower()
+ )
+ if not mmproj_files:
+ return None
+
+ # Prefer F16 variant
+ target = None
+ for f in mmproj_files:
+ if "f16" in f.lower():
+ target = f
+ break
+ if target is None:
+ target = mmproj_files[0]
+
+ logger.info(f"Downloading mmproj: {hf_repo}/{target}")
+ local_path = hf_hub_download(
+ repo_id = hf_repo,
+ filename = target,
+ token = hf_token,
+ )
+ return local_path
+ except Exception as e:
+ logger.warning(f"Could not download mmproj: {e}")
+ return None
+
# ── Lifecycle ─────────────────────────────────────────────────
def load_model(
@@ -588,6 +630,12 @@ class LlamaCppBackend:
hf_variant = hf_variant,
hf_token = hf_token,
)
+ # Auto-download mmproj for vision models
+ if is_vision and not mmproj_path:
+ mmproj_path = self._download_mmproj(
+ hf_repo = hf_repo,
+ hf_token = hf_token,
+ )
elif gguf_path:
if not Path(gguf_path).is_file():
raise FileNotFoundError(f"GGUF file not found: {gguf_path}")