Repository navigation
Studio: still try the last used model first when it is only listed by its HF cache path - #18104
Conversation
…g another (fixes unslothai#18002) When a send auto-loads a model and the remembered one fails, stop and show its error rather than falling through to the smallest model on disk. Also match the remembered repo id against Hugging Face cache rows from /api/models/local, which are named by their snapshot path.
… keep the hf_cache repo id match [skip ci]
…nother HF cache [skip ci]
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Bravo. 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". |
## Gate the split-GPU DPO prefix-share test on a real CUDA device `tests/python/test_accelerator_skip_guards.py::test_no_skip_guard_reads_a_spoofable_accelerator_probe` fails on `main` since #18273. It shows up on unrelated PRs, for example #18104's `Repo tests (CPU, studio)`: ``` these skip guards read a probe tests/_zoo_aggressive_cuda_spoof.py patches to True process-wide ... test_dpo_prefix_share.py:490: torch.cuda.is_available() ``` ### Cause #18273 added `test_verify_with_hidden_states_on_another_device`, a CUDA-only test, behind `@pytest.mark.skipif(not torch.cuda.is_available(), ...)`. `tests/_zoo_aggressive_cuda_spoof.py` patches that probe to `True` process-wide. As a result, the test un-skips on a CPU-only runner whenever it shares a pytest session with `tests/version_compat` or `tests/vllm_compat`. ### Fix The guard now uses `has_real_cuda()` from `tests/_shared/real_accelerator.py`, the same helper the other CUDA-only tests use (#18204, #18224). The test body is unchanged, so on a real GPU it runs exactly as before. ### Verification - `tests/python/test_accelerator_skip_guards.py`: fails on `main` on this line, passes with this change. - `tests/test_dpo_prefix_share.py`: passes on CPU, and the CUDA-only case still skips. 58 passed, 1 skipped across both files. - ruff is clean.
… repo id [skip ci]
…ot listed [skip ci]
## Read the NPU compat fixtures as UTF-8 `tests/test_source_read_encoding.py::test_checked_in_file_reads_name_an_encoding` fails on `main` since #18050. It shows up on unrelated PRs as `Repo tests (CPU, rest-2)`, for example #18104 and #17627: ``` E AssertionError: 1 file reads in the test trees touch a checked-in file with the platform default encoding ... E Left contains one more item: 'studio/backend/tests/test_npu_compat.py:18: read_text()' ``` ### Cause #18050 added two reads of the checked-in fixture `fixtures/npu_compat/hf_configs.json` that call `.read_text()` with no encoding: - `studio/backend/tests/test_npu_compat.py:18` - `studio/backend/tests/test_export_npu_q4nx.py:677` Without an encoding, Python decodes with the platform default, which is the ANSI codepage on Windows. The lint fails that as soon as a fixture gains a non-ASCII byte. ### Fix Both reads now pass `encoding = "utf-8"`. The fixture is JSON, so it is UTF-8 by definition. Nothing else changes. The other bare `.read_text()` in `test_npu_compat.py`, at line 88, reads a file the test itself wrote into `tmp_path`. The lint deliberately leaves those alone, so it is unchanged. ### Verification - `tests/test_source_read_encoding.py`: fails on `main` on both lines and passes with this change (16 passed). - `tests/test_npu_compat.py` and `tests/test_export_npu_q4nx.py`: 96 passed. - ruff is clean.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dcbdcacdb1
ℹ️ 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".
| isSkipped: (candidate: AutoLoadCandidate) => boolean, | ||
| ): Promise<AutoLoadCandidate | null> { | ||
| // Like a cached repo row: the repo id keys saved settings and the record, the snapshot path loads. | ||
| const id = source.repoId ?? source.id; |
There was a problem hiding this comment.
Preserve path-keyed settings when canonicalizing cache snapshots
When a user has selected an inactive-cache GGUF through the local picker and the managed cache listings are unavailable, the last-used ID and saved configuration can both be the snapshot path (toLocalModelInfo exposes row.loadId as id). This substitution changes candidate.id to the repo ID even for an exact remembered-path match, so loadAutoLoadCandidate calls resolveInitialConfig with a different key and silently uses defaults or repo-keyed settings instead. The saved context and GPU-layer settings are consequently dropped, potentially preventing a previously working model from loading. Preserve the path-keyed configuration or adopt it before replacing the candidate identity.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in c1bec5f: the candidate id is the repo id only when the snapshot matched the last used model by repo id alone; a snapshot remembered by its own path keeps its path-keyed settings and record (test_a_snapshot_remembered_by_its_path_keeps_its_path_keyed_settings, fails on the previous head). The repo id stays a display label only.
…id is what was remembered [skip ci]
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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". |
Follow-up to #18106 for #18002.
What was wrong
When you press Send with no model loaded, Studio auto-loads your last used model first. #18106 made a failed load of that model show a warning and keep it remembered. One case still slipped past it: when the managed cache listings fail, the cascade falls back to
/api/models/local, and there a model in another Hugging Face cache (for example the default~/.cache/huggingfacenext to a custom Studio cache) is listed by its snapshot path. The remembered repo id did not match that row, so the model was not tried first, the smallest model on disk loaded with a plain success toast, and its snapshot path replaced the remembered model. That is the original #18002 symptom again. The toasts also named both models by their full snapshot path.What changed
AutoLoadSourcecarries the Hub repo id (model_id) ofhf_cacherows. A row matching the remembered model by id or load id still ranks first; a snapshot matching it only by repo id ranks right after, ahead of every other model. Rows from other sources (models folder, LM Studio, ...) match on their own id or load id only.Loaded unsloth/SmolLM2-135M-Instruct-GGUF (Q4_K_M)) instead of its snapshot path.Testing
tests/studio/test_chat_autoload_failure_gate.pyruns the real auto-load cascade:test_a_failed_last_used_model_in_another_cache_is_still_named_and_kept: cached listings down, two other-cache snapshots, the last used 26B fails to load. main loads onlygemma-4-E2B-it-GGUF(the 26B is never tried); this PR tries the 26B, falls back to E2B withYour last used model unsloth/gemma-4-26B-A4B-it-GGUF (UD-Q4_K_XL) did not load: ..., and records nothing.test_an_exact_last_used_row_outranks_a_snapshot_matched_by_repo_id: the rememberedQ8_0row still loads ahead of a smaller snapshot of the same repo that only hasQ4_K_M.studio/frontend/tests/auto-load-target-key.test.tsranking check fails on main and passes here; allauto-load-*,last-local-model-loadandqueued-model-lifecycletests pass (55),scripts/typecheck.mjsis clean, biome reports the same findings as main.unsloth/SmolLM2-135M-Instruct-GGUFandunsloth/Qwen3-0.6B-GGUFin a non-active HF cache, Qwen's GGUF header corrupted, last used model set tounsloth/Qwen3-0.6B-GGUF(Q4_K_M), the two managed listing requests failed in the browser, then New chat + Send:/api/inference/loadLoaded unsloth/SmolLM2-135M-Instruct-GGUF (Q4_K_M)+Your last used model unsloth/Qwen3-0.6B-GGUF (Q4_K_M) did not load: ...unsloth/Qwen3-0.6B-GGUFLast used model in another HF cache with a corrupted GGUF and the managed listings failing, then Send with nothing loaded. Before: plain success for the stand-in, named by its snapshot path, and the stand-in becomes the last used model. After: a warning naming the last used model and why it did not load; it stays remembered.