Repository navigation
Studio: hide the RAG embedder and llama.cpp probe from the hub cached inventory - #7018
Conversation
The hub inventory scans behind /api/hub/cached-gguf and /api/hub/cached-models returned the llama.cpp install validation probe (ggml-org/models) and the RAG embedder (unsloth/bge-small-en-v1.5[-GGUF]) as on-device models. Share the hidden-model check from routes/models.py via utils/models/hidden_models.py and apply it in both scans. A GGUF infra repo stays visible when the user explicitly downloaded a variant through the Hub, since variant manifests only exist for user-initiated downloads.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ac010b73a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…y, lighten the hidden-model import Follow-up on the hub cached-inventory hidden-model change, addressing the review. On Device now trusts the Hub inventory API for cached rows. The backend already hides the RAG embedder and the llama.cpp probe and re-includes a GGUF infra repo once the user downloads a variant through the Hub, but the frontend was re-hiding it by repo id, so the user-downloaded variant never appeared in the On Device list or the count. isVisibleInventoryRow now short-circuits cached rows (kind === "cache") to visible and keeps client-side needle hiding only for local filesystem rows and Discover. is_hidden_model matches Hub repo ids exactly (case-insensitive) against the probe plus the effective embedder and its GGUF companion, instead of substring matching the configured-embedder basename. A custom embedder with a generic basename like org/model no longer hides unrelated cached repos such as user/model-chat or org/model-instruct. The probe filename and local-path embedders keep exact matching. The helper moves to utils/hidden_models.py and is imported at module scope in the hub cache scanner, so it no longer pulls in utils/models/__init__ (the eager model-config/checkpoint stack) and a broken import fails at startup instead of being swallowed per-repo and silently emptying the inventory. routes.models keeps the _is_hidden_model and _safe_resolve aliases and drops the unused _HF_REPO_ID_RE re-export that was failing source lint. Tests: exact repo-id matching with a custom embedder, the cached-models scan keeping an unrelated repo, and a clean-interpreter check that the helper imports without the model-config stack.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 611ddbdb7b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The hidden-model check compared the probe's on-disk filename with
Path(value).name, which on a POSIX interpreter does not split a Windows-style
path ("...\stories260K.gguf") and would let the probe through. Split on both
separators so the probe is matched regardless of which OS produced the path,
matching the tolerance of the previous substring check. Adds a Windows-path
assertion to the probe test.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d324de468
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4fbd8980eb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18cf9c0381
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Hide infra repos unless the user downloaded a variant via | ||
| # the Hub; variant state only exists for user downloads. | ||
| if is_hidden_infra and not has_variant_state: | ||
| continue |
There was a problem hiding this comment.
Filter hidden embedders from hub local rows too
When this skip runs for a configured custom embedder, the model is only removed from /api/hub/cached-*; /api/hub/local still scans the same HF cache as a source="hf_cache" local row, and the frontend local filter only has static bge/probe needles. Because dedupe suppresses HF-cache local rows only when a cached row remains, a custom hidden embedder such as org/embedder resurfaces in On Device as a runnable local row; the hub local inventory needs the same is_hidden_model filtering.
Useful? React with 👍 / 👎.
| if (row.optimistic) { | ||
| capabilities.canChat = false; |
There was a problem hiding this comment.
Preserve chat on server-confirmed hint merges
For completed non-GGUF downloads, the completed hint byte count comes from the full snapshot download, while _scan_cached_models() reports size_bytes for runnable weights only. When that confirmed server row is present but smaller than the hint, reconciliation keeps the hint and merges it as optimistic, so this branch disables canChat on an already-downloaded model and can leave the On Device Run action unavailable until the completed hint is suppressed/removed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0903940e3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| continue | ||
| repo_id = repo_info.repo_id | ||
| # The non-GGUF embedder has no variant downloads; always hide. | ||
| if _is_hidden_infra_repo(repo_id, str(repo_info.repo_path)): |
There was a problem hiding this comment.
Pass resolved snapshot paths to hidden checks
When the RAG embedding model is configured as an existing HF snapshot directory, e.g. /.../models--org--embedder/snapshots/abc, is_hidden_model records that exact resolved path, but this cache scan still passes only the repo id and repo cache root. The fresh evidence is that the current call uses repo_info.repo_path rather than the resolved snapshot path that _cached_model_snapshot_path/the local classifier already compute, so the configured embedder is not filtered from /api/hub/cached-models; the hub local row has the same repo-root model.path, so it can still appear in On Device as a runnable custom RAG embedder.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9fe8635c0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if _path_contains_repo_id(v, hidden_repo_ids): | ||
| return True |
There was a problem hiding this comment.
Keep basename-only default embedders hidden
When the default embedder is present as a local folder/file outside the HF cache, such as ./models/bge-small-en-v1.5 or ./models/bge-small-en-v1.5-F16.gguf, the local scanners pass only the path/id and no unsloth/... repo id. This new path branch only recognizes repo-derived segments like models--unsloth--bge-small-en-v1.5 or .../unsloth/bge-small-en-v1.5, so _is_hidden_model returns false for those basename-only local copies; unlike the Hub page, /api/models/local and the auto-switch catalog rely on this backend filter and can list/select the embedding model as a chat model. The previous basename needle hid these default embedder paths, so keep that fallback for the static default infra IDs while preserving exact matching for custom repos.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2040f45413
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for model in ( | ||
| rag_config.effective_embedding_model(), | ||
| rag_config.effective_gguf_repo(), |
There was a problem hiding this comment.
Invalidate inventory when the hidden embedder changes
Because inventory visibility now depends on effective_embedding_model() / effective_gguf_repo(), changing the RAG embedding model while the Hub inventory store is already ready leaves stale rows keyed only by inventoryVersion and token; I checked the settings save/reset path (general-tab.tsx -> updateEmbeddingModelSettings/resetEmbeddingModelSettings) and it only updates local settings state, so selecting an already cached custom embedder can leave its previously fetched chat-capable On Device row visible until an unrelated inventory mutation or full reload. Please bump the Hub inventory version on embedding-model save/reset, or include the setting in the inventory request key.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in ef81dbe. Saving or resetting the embedding model now calls bumpInventoryVersion(), and useHiddenEmbeddingModelIds re-fetches the backend-resolved embedder ids on that bump, so the On Device list re-hides the previous embedder immediately instead of waiting for an unrelated mutation or full reload.
| hidden_repo_ids = { | ||
| _PROBE_REPO_ID.lower(), | ||
| *(repo_id.lower() for repo_id in _DEFAULT_EMBEDDING_REPO_IDS), |
There was a problem hiding this comment.
Keep env-default embedders hidden after overrides
Fresh evidence after the stale-default fix: this hidden set seeds only the hard-coded Unsloth defaults before adding the current effective model below. In deployments that set RAG_EMBEDDING_MODEL=org/default-embed, once a user saves a different Settings embedder, the previously auto-cached env-default org/default-embed / org/default-embed-GGUF no longer matches either set and is returned by the cache/local inventories as a runnable chat model. Include rag_config.EMBEDDING_MODEL and its GGUF companion in the always-hidden defaults.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in ef81dbe. The always-hidden set now seeds EMBEDDING_MODEL and default_gguf_repo() alongside the effective embedder pair, so an env-configured default (RAG_EMBEDDING_MODEL) and its GGUF companion stay hidden after a Settings override. Covered by a new case in test_cached_gguf_routes.py.
| !row.optimistic || | ||
| !isHiddenModelId(row.id, row.repoId, row.cachePath) |
There was a problem hiding this comment.
Filter optimistic rows for custom embedders
Fresh evidence after the optimistic-row fix: this guard relies on the client isHiddenModelId needles, which only cover the static bge/probe IDs, while the backend hidden check also hides the configured custom RAG embedder. If a user with org/embedder configured starts or completes a Hub download for that repo, the server omits it but the live/completed optimistic row is merged client-side and passes this guard until the job/hint expires, so the hidden embedder still appears in On Device. The optimistic filter needs the effective embedder/companion or should suppress hints once the server hides them.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in ef81dbe. The optimistic cache-row guard now also checks isConfiguredHiddenModelId against the backend-resolved embedder ids, so a configured custom embedder (and its GGUF companion) is hidden while its Hub download is still an optimistic client-side row.
…-hub-inventory # Conflicts: # studio/frontend/src/features/hub/index.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a98580c1fd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| !isConfiguredHiddenModelId( | ||
| hiddenEmbeddingModelIds, | ||
| row.id, | ||
| row.repoId, | ||
| row.cachePath, | ||
| )) |
There was a problem hiding this comment.
Hide configured embedder from Discover too
When the RAG embedding model is a custom Hub repo such as org/embedder, this configured-id set is only applied to optimistic cache rows. I checked the ModelsPage Discover/feed filters in this file and they still only call the static isHiddenModelId(row.id), so a Hub result for the configured embedder can still be shown as a downloadable/chat model even though the backend inventories now hide it as infrastructure. Apply the configured hidden IDs to Discover/feed rows as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in bab5fa3. The Discover list and the trending feed now also apply isConfiguredHiddenModelId(hiddenEmbeddingModelIds, row.id), so a configured custom RAG embedder is hidden from Discover and the feed the same way the static default and probe are. Both memo dependency arrays include the resolved ids. tsc passes and the change adds no new biome diagnostics.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
… inventory (unslothai#7018) * Studio: hide infra models from the hub cached inventory The hub inventory scans behind /api/hub/cached-gguf and /api/hub/cached-models returned the llama.cpp install validation probe (ggml-org/models) and the RAG embedder (unsloth/bge-small-en-v1.5[-GGUF]) as on-device models. Share the hidden-model check from routes/models.py via utils/models/hidden_models.py and apply it in both scans. A GGUF infra repo stays visible when the user explicitly downloaded a variant through the Hub, since variant manifests only exist for user-initiated downloads. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: make On Device trust the hub inventory, match repo ids exactly, lighten the hidden-model import Follow-up on the hub cached-inventory hidden-model change, addressing the review. On Device now trusts the Hub inventory API for cached rows. The backend already hides the RAG embedder and the llama.cpp probe and re-includes a GGUF infra repo once the user downloads a variant through the Hub, but the frontend was re-hiding it by repo id, so the user-downloaded variant never appeared in the On Device list or the count. isVisibleInventoryRow now short-circuits cached rows (kind === "cache") to visible and keeps client-side needle hiding only for local filesystem rows and Discover. is_hidden_model matches Hub repo ids exactly (case-insensitive) against the probe plus the effective embedder and its GGUF companion, instead of substring matching the configured-embedder basename. A custom embedder with a generic basename like org/model no longer hides unrelated cached repos such as user/model-chat or org/model-instruct. The probe filename and local-path embedders keep exact matching. The helper moves to utils/hidden_models.py and is imported at module scope in the hub cache scanner, so it no longer pulls in utils/models/__init__ (the eager model-config/checkpoint stack) and a broken import fails at startup instead of being swallowed per-repo and silently emptying the inventory. routes.models keeps the _is_hidden_model and _safe_resolve aliases and drops the unused _HF_REPO_ID_RE re-export that was failing source lint. Tests: exact repo-id matching with a custom embedder, the cached-models scan keeping an unrelated repo, and a clean-interpreter check that the helper imports without the model-config stack. * Studio: match the llama.cpp probe filename on both path separators The hidden-model check compared the probe's on-disk filename with Path(value).name, which on a POSIX interpreter does not split a Windows-style path ("...\stories260K.gguf") and would let the probe through. Split on both separators so the probe is matched regardless of which OS produced the path, matching the tolerance of the previous substring check. Adds a Windows-path assertion to the probe test. * Studio: harden hidden infra model handling * Fix hidden cache row confirmation * Fix hidden local rows and confirmed hint merges * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Handle snapshot-configured hidden models * Hide basename-only default embedders * Fix dynamic embedder inventory filtering * Studio: hide the configured RAG embedder from Discover and feed rows --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: danielhanchen <[email protected]> Co-authored-by: Daniel Han <[email protected]>
…#15256) Fixes unslothai#15110 ## Problem Picking a downloaded embedding model in Settings > General > Embedding (for example `unsloth/embeddinggemma-2`) removed it from the Hub. Both the safetensors repo and its `-GGUF` companion dropped out of `/api/hub/cached-models` and `/api/hub/cached-gguf`, so the model could no longer be seen or deleted from the Hub On Device list, even though `/v1/embeddings` kept serving it. The cache scans hide the RAG embedder as infrastructure. unslothai#7018 meant that for the auto-downloaded default (bge-small) and kept a deliberately downloaded infra GGUF variant visible as a non-chat row. The non-GGUF scan had no equivalent, and a GGUF fetched without a Hub variant record was hidden too, so a user-picked embedder vanished. ## Fix - `utils/hidden_models.is_selected_embedder(repo_id)`: true for the embedder or GGUF repo picked in Settings, never the env/default one (exact repo id match, same rules as `is_hidden_model`). - Both cache scans keep such a repo as a management row. It is still `hidden_infra`, so `can_chat` stays false (no Run action, no chat auto-load), and `is_hidden_model` / `/api/hub/hidden-models` are unchanged, so chat and API pickers still hide it. - The default embedder and the llama.cpp probe stay hidden exactly as before. ## Before / after (real HF cache with `unsloth/embeddinggemma-2` + `embeddinggemma-2-F16.gguf`, real Settings store) | | before | after | |---|---|---| | default embedder: cached-models | `embeddinggemma-2` (can_chat false) | same | | default embedder: cached-gguf | `embeddinggemma-2-GGUF` | same | | embeddinggemma-2 picked: cached-models | row missing | `embeddinggemma-2` (can_chat false) | | embeddinggemma-2 picked: cached-gguf | row missing | `embeddinggemma-2-GGUF` (can_chat false) | | embeddinggemma-2 picked: hidden from chat pickers | yes | yes | ## Tests - New `test_cached_scans_keep_settings_picked_embedder_as_non_chat_rows` (fails on main, passes here). - `test_cached_models_scan_keeps_unrelated_repo_with_custom_generic_embedder` now expects the picked embedder as a non-chat row next to the unrelated repo. - `hub/tests/test_model_services.py`, `tests/test_cached_gguf_routes.py`, `tests/test_model_picker_regression.py`, `tests/test_decision_models_not_chattable.py` pass, apart from 5 `test_delete_variant_*` cases that fail identically on main in this environment. ## Screenshots Two Studio installs (merge base vs this branch) on one isolated HF cache holding `unsloth/embeddinggemma-2` and `embeddinggemma-2-F16.gguf`, after picking `unsloth/embeddinggemma-2` through the Settings embedding API, searching On Device for it. Before: "No matches on device". After: both repos listed, no Run action.  The row menu offers Delete, so the embedder can be removed again. 
Problem
The shared Hub inventory still returned Studio's RAG embedder and llama.cpp validation probe as on-device chat models. The filtering also had edge cases for custom embedders, local paths, previously cached defaults, user-downloaded GGUF variants, and optimistic download rows.
Fix
utils/hidden_models.pywithout importing the eager model utility package.model_idinto local inventory and auto-switch filtering.Impact
Infrastructure models no longer appear as runnable chat models. A deliberately downloaded infra GGUF variant remains manageable from On Device without exposing a Run action.
Validation
hub/tests/test_model_services.py: 107 passedtests/test_cached_gguf_routes.py: 29 passedtests/test_openai_auto_switch.py: 150 passed