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
Keep companion-only GGUF folders out of the custom model list, and stop testing vision on an empty projector (#7728)
Daniel Hana6c7fc8e2760
diff --git a/studio/backend/routes/models.py b/studio/backend/routes/models.pyindex 51c1bd34061..d6678e55f31 100644--- a/studio/backend/routes/models.py+++ b/studio/backend/routes/models.py@@ -285,6 +285,25 @@ def _has_non_gguf_weights(path: Path) -> bool:return False+def _is_gguf_companion_only_dir(path: Path) -> bool:+ """True for a folder whose entire content is GGUF companions -- a lone mmproj adapter, an+ MTP drafter, or both -- with nothing servable beside them.++ The scanners report ``model_format = None`` for such a folder, because neither companion is a+ primary weight, and that is also what a plain checkpoint reports. The custom-folder scan below+ validates GGUF rows through ``detect_gguf_model`` and waves the rest through, so without this+ the folder is published as a model that no loader can start.+ """+ try:+ if not path.is_dir():+ return False+ if (path / "config.json").exists() or (path / "adapter_config.json").exists():+ return False+ return any(path.glob("*.gguf")) and not _has_non_gguf_weights(path)+ except OSError:+ return False++def _scan_models_dir(models_dir: Path, *, limit: int | None = None) -> List[LocalModelInfo]:if not models_dir.exists() or not models_dir.is_dir():return []@@ -874,10 +893,11 @@ def collect_local_models(models_root: Path) -> List[LocalModelInfo]:]custom_models = []for model in _generic:- if model.model_format != "gguf" or model.partial:+ path = Path(model.path)+ is_gguf_row = model.model_format == "gguf" or _is_gguf_companion_only_dir(path)+ if not is_gguf_row or model.partial:custom_models.append(model)continue- path = Path(model.path)if path.is_dir():patterns = ("*", "*/*") if model.source == "hf_cache" else ("*",)if any(diff --git a/studio/backend/tests/test_vision_cache.py b/studio/backend/tests/test_vision_cache.pyindex 18b532cc9ba..80ce855e5ab 100644--- a/studio/backend/tests/test_vision_cache.py+++ b/studio/backend/tests/test_vision_cache.py@@ -145,6 +145,10 @@ class TestVisionCacheSubprocessPath:class TestLocalGgufVisionDetection:+ """``detect_mmproj_file`` skips a zero-byte projector as an interrupted download, so every+ projector fixture here is written non-empty; the byte content itself is never read (there is+ no GGUF header, so pairing falls back to the filename)."""+@patch("utils.models.model_config._is_vision_model_subprocess",side_effect = AssertionError("GGUF must not use Transformers vision detection"),@@ -152,7 +156,7 @@ class TestLocalGgufVisionDetection:def test_qwen36_gguf_with_mmproj_skips_transformers(self, mock_subprocess, tmp_path):model = tmp_path / "Qwen3.6-27B-UD-Q4_K_XL-MTP.gguf"model.write_bytes(b"")- (tmp_path / "mmproj-F32.gguf").write_bytes(b"")+ (tmp_path / "mmproj-F32.gguf").write_bytes(b"\0" * 32)assert is_vision_model(str(model)) is Truemock_subprocess.assert_not_called()@@ -166,7 +170,7 @@ class TestLocalGgufVisionDetection:variant_dir.mkdir()model = variant_dir / "Qwen3.6-27B-UD-Q4_K_XL-MTP.gguf"model.write_bytes(b"")- (tmp_path / "mmproj-F32.gguf").write_bytes(b"")+ (tmp_path / "mmproj-F32.gguf").write_bytes(b"\0" * 32)assert is_vision_model(str(model)) is Truemock_subprocess.assert_not_called()@@ -187,7 +191,7 @@ class TestLocalGgufVisionDetection:model.write_bytes(b"")assert is_vision_model(str(model)) is False- (tmp_path / "mmproj-F32.gguf").write_bytes(b"")+ (tmp_path / "mmproj-F32.gguf").write_bytes(b"\0" * 32)assert is_vision_model(str(model)) is True@patch(@@ -198,7 +202,7 @@ class TestLocalGgufVisionDetection:model = tmp_path / "Qwen3.6-27B-UD-Q4_K_XL-MTP.gguf"model.write_bytes(b"")mmproj = tmp_path / "mmproj-F32.gguf"- mmproj.write_bytes(b"")+ mmproj.write_bytes(b"\0" * 32)config = ModelConfig.from_ui_selection(str(model), None)@@ -220,7 +224,7 @@ class TestLocalGgufVisionDetection:model = variant_dir / "Qwen3.6-27B-UD-Q4_K_XL-MTP.gguf"model.write_bytes(b"")mmproj = tmp_path / "mmproj-F32.gguf"- mmproj.write_bytes(b"")+ mmproj.write_bytes(b"\0" * 32)config = ModelConfig.from_ui_selection(str(model), None)