Skip to content

Show loadable Hugging Face snapshots from custom folders in Select Model - #17673

Merged
danielhanchen merged 9 commits into
unslothai:mainfrom
Imagineer99:fix/picker-custom-cache
Nov 15, 2026
Merged

danielhanchen merged 9 commits into
unslothai:mainfrom
Imagineer99:fix/picker-custom-cache

Conversation

@Imagineer99

@Imagineer99 Imagineer99 commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

When a registered custom folder contains a Hugging Face cache, Models Hub can list complete local snapshots that Select Model omits. This happens when the folder is outside the active cache and the snapshot must be loaded by path.

Include chat-capable snapshots with a local load path after shared inventory deduplication. Keep partial downloads and companion-prefetch rows out of the picker. Give GGUF and Safetensors entries distinct row keys when they share a load path.

Verification

  • On an isolated Windows fixture, the picker went from 22 of 35 models to 35 of 35. Searching for fixture/Restored-ST went from zero to 12 matches. A GGUF entry was also recovered.
  • Playwright captured the real picker in Chromium with recorded inventory responses and verified that selecting a restored model passed its exact Windows snapshot path.
  • All 28 targeted frontend tests and the TypeScript test typecheck passed.

Select Model before and after including registered custom-cache snapshots

Before / after on Linux (merge base vs PR head)

Two isolated Studio installs, an empty active Hugging Face cache, and one registered custom folder holding a Hugging Face cache with fixture/Restored-GGUF (GGUF) and fixture/Restored-ST (Safetensors). Both builds list both snapshots in /api/hub/local with active_cache: false. Select Model > On Device lists none of them on the merge base, and lists fixture/Restored-GGUF under Local models on this branch. The Safetensors row stays hidden because this host has no GPU, so the chat-only gate applies, as it does for any other local Safetensors folder. Picking the GGUF row resolved its variant list (Q4_K_M) and sent /api/inference/load the custom-folder snapshot path, which then loaded through llama-server.

Select Model On Device before and after, registered custom folder holding a Hugging Face cache

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T10:17:09.791011Z 8e3a8e2 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 15, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

A local directory load picks the GGUF before Transformers, so the separate
Safetensors row of a snapshot holding both formats loaded the GGUF. With one
row per load path the option keys need no inventory id, which also keeps the
selected-row lookup working.

[skip ci]
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6afbeb90ad

ℹ️ 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".

Comment on lines +26 to +27
// A partial GGUF has no file linked into the snapshot yet, so the directory load skips it.
.filter((row) => row.modelFormat === "gguf" && !row.partial)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include payload-bearing partial GGUF rows in the format guard

If an inactive-cache snapshot contains complete Safetensors weights plus a finished shard from a cancelled split-GGUF download, its GGUF row is partial even though that shard is already linked into snapshots/. The new !row.partial condition provides a counterexample to the earlier format-selection fix: detect_gguf_model() still returns that shard when no complete GGUF alternative exists. Consequently, the picker offers the Safetensors row, but selecting its directory dispatches to GGUF and fails instead of loading the usable Safetensors weights. Distinguish manifest-only partial rows from rows with actual GGUF files, or provide a format-aware load target.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this here. It needs a mixed repo in an inactive cache plus a cancelled split-GGUF download that already linked one shard; the load then errors (no wrong model), where the merge base offered nothing. The cause is detect_gguf_model falling back to a torn shard when no whole split exists, which hits any custom folder holding Safetensors plus a torn shard today, so it belongs in the loader, not in this picker filter.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 15, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 15, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 15, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 15, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 15, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: d35bf856b0

ℹ️ 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".

# Conflicts:
#	studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx

[skip ci]
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 15, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

An active-cache GGUF copy of the same repo made dedupe drop the custom
snapshot's GGUF row, which unhid its Safetensors row although the
directory load still picks the GGUF.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 8e3a8e2b21

ℹ️ 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".

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 15, 2026
@danielhanchen
danielhanchen merged commit 04ce457 into unslothai:main Nov 15, 2026
danielhanchen added a commit that referenced this pull request Nov 15, 2026
…narios run on main again (#17816)

## Summary

`tests/studio/test_chat_autoload_failure_gate.py` has failed 85 of 86
scenarios on `main` since #17673 ("Show loadable Hugging Face snapshots
from custom folders in Select Model"). It shows up in `Repo tests (CPU,
studio)`, first on the staging run of #16717:

```
tests/studio/test_chat_autoload_failure_gate.py:950: in _build_harness
E   AssertionError: the sliced region uses ['isOtherCacheSnapshot'], imported by chat-adapter.ts but absent
    from this harness. Add a stub to PREAMBLE, or these scenarios will fail as wrong-model assertions
```

#17673 is correct. `isAutoLoadableLocalRow` now admits another cache's
snapshot rows through `isOtherCacheSnapshot` (from
`features/model-picker/inventory/local-cache-snapshot.ts`). The harness
slices that region of `chat-adapter.ts` and supplies its imports itself,
and its import guard flagged the new name as intended.

## Change (test only)

The harness now inlines the shipped `isOtherCacheSnapshot`, plus the
`looksLikeLocalPath` it calls, read from source. It already inlines
`server-model-wait.ts` and `load-request.ts` the same way. A
hand-written stub would let the scenarios drift from the rule auto-load
actually applies. If the function stops being a top-level `export
function`, the extraction asserts and names the file.

## Verification

| | `test_chat_autoload_failure_gate.py` |
|---|---|
| main (`04ce4572`) | 85 failed, 1 passed |
| this branch | 86 passed |

Every `tests/studio` file that reads `chat-adapter.ts` (16 files): 446
passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants