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.

Studio: keep a Settings-picked embedder visible in the Hub (#15256)

Daniel Handb1e8d9c4cc6
diff --git a/studio/backend/hub/services/models/cache_inventory.py b/studio/backend/hub/services/models/cache_inventory.py
index 455b3868534..1766784b628 100644
--- a/studio/backend/hub/services/models/cache_inventory.py
+++ b/studio/backend/hub/services/models/cache_inventory.py
@@ -53,6 +53,7 @@ from utils.hidden_models import (
is_curated_tts_repo_id,
is_decision_api_model,
is_hidden_model,
+ is_selected_embedder,
)
logger = get_logger(__name__)
@@ -638,12 +639,13 @@ def _scan_cached_gguf(
str(snapshot_path) if snapshot_path is not None else None,
)
is_curated_stt = is_curated_stt_repo_id(repo_id) or is_audio_cpp_repo_id(repo_id)
- # Hide infra repos unless the user downloaded a variant: variant state only exists for user downloads, and curated STT and Decision API repos are still emitted as management rows.
+ # Hide infra repos unless the user downloaded a variant (variant state only exists for user downloads); curated STT, Decision API and Settings-picked embedder repos stay as management rows.
if (
is_hidden_infra
and not is_curated_stt
and not has_variant_state
and not is_decision_api_model(repo_id)
+ and not is_selected_embedder(repo_id)
):
continue
if total_size == 0 and not has_variant_state:
@@ -1207,7 +1209,6 @@ def _scan_cached_models(
repo_id = repo_info.repo_id
repo_path = Path(repo_info.repo_path)
snapshot_path = _cached_model_snapshot_path(repo_path)
- # The non-GGUF embedder has no variant downloads; always hide.
is_hidden_infra = _is_hidden_infra_repo(
repo_id,
str(repo_path),
@@ -1221,6 +1222,7 @@ def _scan_cached_models(
and not is_curated_stt
and not is_whisper_stt
and not is_decision_api_model(repo_id)
+ and not is_selected_embedder(repo_id)
):
continue
has_main_gguf = _repo_has_gguf_files(repo_info)
diff --git a/studio/backend/hub/tests/test_model_services.py b/studio/backend/hub/tests/test_model_services.py
index 18501585dbb..760d467a2c9 100644
--- a/studio/backend/hub/tests/test_model_services.py
+++ b/studio/backend/hub/tests/test_model_services.py
@@ -3006,7 +3006,58 @@ def test_cached_models_scan_keeps_unrelated_repo_with_custom_generic_embedder(
result = {"cached": cache_inventory._scan_cached_models()}
- assert [row["repo_id"] for row in result["cached"]] == ["user/model-chat"]
+ can_chat = {row["repo_id"]: row["capabilities"]["can_chat"] for row in result["cached"]}
+ assert sorted(can_chat) == ["org/model", "user/model-chat"]
+ assert can_chat["org/model"] is False
+
+
+def test_cached_scans_keep_settings_picked_embedder_as_non_chat_rows(monkeypatch, tmp_path):
+ # #15110: picking a downloaded embedder in Settings dropped it and its GGUF from the Hub, so it could not be deleted.
+ from core.rag import config as rag_config
+
+ monkeypatch.setattr(rag_config, "effective_embedding_model", lambda: "unsloth/embeddinggemma-2")
+ monkeypatch.setattr(rag_config, "effective_gguf_repo", lambda: "unsloth/embeddinggemma-2-GGUF")
+
+ weights_path = tmp_path / "hub" / "models--unsloth--embeddinggemma-2"
+ weights_path.mkdir(parents = True)
+ weights = _repo(
+ "unsloth/embeddinggemma-2",
+ [_file("config.json", 12), _file("modules.json", 12), _file("model.safetensors", 1_000)],
+ weights_path,
+ )
+ gguf = _repo(
+ "unsloth/embeddinggemma-2-GGUF",
+ [_file("embeddinggemma-2-F16.gguf", 1_000)],
+ tmp_path / "hub" / "models--unsloth--embeddinggemma-2-GGUF",
+ )
+ default_path = tmp_path / "hub" / "models--unsloth--bge-small-en-v1.5"
+ default_path.mkdir(parents = True)
+ default = _repo(
+ "unsloth/bge-small-en-v1.5",
+ [_file("config.json", 12), _file("model.safetensors", 1_000)],
+ default_path,
+ )
+ monkeypatch.setattr(
+ cache_inventory,
+ "all_hf_cache_scans",
+ lambda: [SimpleNamespace(repos = [weights, gguf, default])],
+ )
+ monkeypatch.setattr(cache_inventory.hf_cache_scan, "is_gguf_repo_partial", _not_partial_gguf)
+ monkeypatch.setattr(cache_inventory.hf_cache_scan, "is_snapshot_partial", _not_partial_snapshot)
+
+ models = cache_inventory._scan_cached_models()
+ ggufs = cache_inventory._scan_cached_gguf()
+
+ assert [(r["repo_id"], r["capabilities"]["can_chat"]) for r in models] == [
+ ("unsloth/embeddinggemma-2", False)
+ ]
+ assert [(r["repo_id"], r["capabilities"]["can_chat"]) for r in ggufs] == [
+ ("unsloth/embeddinggemma-2-GGUF", False)
+ ]
+ from utils.hidden_models import is_hidden_model
+
+ assert is_hidden_model("unsloth/embeddinggemma-2")
+ assert is_hidden_model("unsloth/embeddinggemma-2-GGUF")
def test_cached_scans_hide_stale_default_embedder_after_custom_setting(monkeypatch, tmp_path):
diff --git a/studio/backend/utils/hidden_models.py b/studio/backend/utils/hidden_models.py
index df68e4f7f39..baae39c201d 100644
--- a/studio/backend/utils/hidden_models.py
+++ b/studio/backend/utils/hidden_models.py
@@ -184,6 +184,24 @@ def _path_basename_is_default_embedder(value: str) -> bool:
)
+def is_selected_embedder(repo_id: str | None) -> bool:
+ """True if *repo_id* is the Settings-picked (not env/default) embedder or its GGUF; the Hub keeps it as a deletable non-chat row."""
+ if not repo_id or not _HF_REPO_ID_RE.match(repo_id):
+ return False
+ from core.rag import config as rag_config
+
+ defaults = {
+ rag_config.EMBEDDING_MODEL.lower(),
+ rag_config.default_gguf_repo().lower(),
+ *(repo.lower() for repo in _DEFAULT_EMBEDDING_REPO_IDS),
+ }
+ wanted = repo_id.lower()
+ return wanted not in defaults and any(
+ model and model.lower() == wanted and not _existing_resolved_path(model)
+ for model in (rag_config.effective_embedding_model(), rag_config.effective_gguf_repo())
+ )
+
+
def is_hidden_model(*values: str | None) -> bool:
"""True if any id/path is the RAG embedding model (the effective embedder or its GGUF companion repo), the llama.cpp install validation probe (ggml-org/models / stories260K), a curated/custom Whisper dictation model, or a Decision API model, so pickers hide them (GGUF and non-GGUF). None are usable chat models, and the probe can be cached as a side effect of installing the prebuilt llama-server and otherwise sorts smallest, so it would be auto-selected.