Repository navigation
[Feature] Unsloth Studio / Desktop: unsloth list-npu-models lists the AMD NPU models with download and memory-fit state - #18049
Conversation
…nd memory-fit state
# Conflicts: # unsloth_cli/tests/test_npu_cli.py
|
@codex review |
1 similar comment
|
@codex review |
Codex Review Summary: 🔄 RunningThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ffeae15467
ℹ️ 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".
| repo = str(model.get("hf_repo") or "").strip() | ||
| return repo.rsplit("/", 1)[-1] or str(model.get("id")) |
There was a problem hiding this comment.
Preserve display names for locally converted NPU models
When Studio has locally converted Q4NX models, its catalog includes rows with local.folder but no hf_repo (see LemonadeNpuBackend._local_rows). This helper therefore prints the generated local-npu-q4nx-<hash>-q4nx-FLM identifier in both NAME and ID. For exports stored under <run>/npu-q4nx, the actual run/model name disappears entirely, so users cannot identify which ID belongs to which fine-tuned model. Handle local.folder before the Hugging Face fallback, matching Studio’s npuDisplayName/npuLocalLabel behavior in studio/frontend/src/features/npu/display-name.ts.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 3697f93: converted rows are listed by their folder name (the save folder for /npu-q4nx), as npuDisplayName does.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 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". |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! 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". |
) ## Record the NPU detector's file load in the risky-loader baseline The risky-loader lint in `Source lint` fails on `main` since #18049. It shows up on unrelated PRs, for example #17550: ``` 1 risky loader call site(s) not in the baseline: unsloth_cli/_npu.py:88 [dynamic-import] spec_from_file_location ``` ### Cause #18049 added `npu_detected()` to `unsloth_cli/_npu.py`. The CLI uses it to reuse Studio's stdlib-only NPU detector without importing the Studio backend. It loads the file through `importlib.util.spec_from_file_location`, which `scripts/lint_risky_loaders.py` flags until the call site is reviewed and recorded. ### Why it is safe The path is fixed: `Path(__file__).resolve().parents[1] / "studio/backend/utils/hardware/npu.py"`. That is a file shipped in the same package, and no user, network or checkpoint input chooses it. Any failure, including a missing file, is caught and returns `False`. So the lint's own guidance applies: record the call site with a reason rather than change the code. ### Fix One new entry in `scripts/risky_loaders_baseline.json`, generated with `python scripts/lint_risky_loaders.py --update`. The generated `REVIEW ME` placeholder is replaced with the reason above. No other entry moves, and no code changes. ### Verification - `python scripts/lint_risky_loaders.py`: fails on `main` on this call site and passes with this change. `--self-test` passes too. - The repo's risky-loader tests pass: 46 passed.
unsloth chatandunsloth inferencetake an NPU model by its-FLMid, but nothing in the CLI told you which ids exist.unsloth list-npu-modelsprints the catalog the app shows: the Hugging Face name (same name as the model picker since #17610), the-FLMid, the size, whether it's downloaded (or how far a resumable download got), and whether it fits the memory the NPU can map on this PC.Where the data comes from:
/api/npu/statusand/api/npu/models, so the names, sizes and thememory_needed_gb/fits_memoryfields are the backend's own. It only reads; it never enables the runtime or starts a download.UNSLOTH_STUDIO_ENABLE_NPU, or FastFlowLM not installed is still named. When the runtime is ready it says to start Unsloth Studio, because the-FLMcatalog comes from Lemonade, which only Unsloth Studio runs.Every case it can't list is one line and exit 1, like
list-checkpoints' errors. It sits next tolist-checkpointsas a top-level command; no--json, since no list command has one.Before / after on a real NPU
Same AMD DevLab runner, same job, Unsloth Studio installed from main and from this branch (run).
Before (main):
No such command 'list-npu-models'.After: no runtime yet, with and without Unsloth Studio running (exit 1, one line); then
unsloth inference qwen3-0.6b-FLMenables the runtime and downloads the model; then the full listing with that model downloaded and the rest not (exit 0); then, with Unsloth Studio stopped, the one-line "isn't running" message.Tests
unsloth_cli/tests/test_npu_cli.py: the listing with downloaded, partly downloaded and not downloaded rows and fits / doesn't fit / unknown; no NPU, NPU turned off, an XDNA 1 NPU, FastFlowLM not installed, runtime installed but not enabled; no Unsloth Studio with a missing NPU, a missing runtime and a ready one; a dropped connection; and the real backendstatus()answering without starting the runtime.test_cli_lazy_commands.pygets the new command in its fixed order.Full CLI suite: 2669 passed, 4 failed; the same 4 (
test_doctor_mcp.py) fail on main.Backend suite: no file under
studio/changes; on a Mac the full run hangs in the same test on main and on this branch.Not covered
UNSLOTH_STUDIO_URLis refused, same asunsloth chat: the CLI only sends its self-issued token to a local Unsloth Studio.