Skip to content

[Bug] AMD NPU: shared Hub ?npu= links only open their card when the format filter is already NPU, and the card's README can be newer than the installed files - #17525

Merged
danielhanchen merged 14 commits into
unslothai:mainfrom
LeoBorcherding:studio/npu-hub-link-and-revision
Nov 14, 2026

Conversation

@LeoBorcherding

@LeoBorcherding LeoBorcherding commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Stacks on #17514 (merge that first; this branch includes its commit).

A ?npu=<id> Hub link only opened its model card when the Hub's format filter was already NPU. On any other filter the row was never selected and the cleanup effect dropped the param, so a shared link just landed on the normal Hub. The link now switches the current tab (Discover or On Device) to NPU once, before the param can be cleared. Closing the pane resets this, so the same link works again, and the link survives while the NPU runtime is still being set up.

FastFlowLM's model_list.json pins repos by branch (main, or a named branch), and model_info.json only holds per-file blob hashes, not a commit. So the README fetched from Hugging Face can be newer than the hash-checked files on disk. Unless the revision is a full commit SHA, the card now says "Latest on Hugging Face (may be newer than the installed files)".

Tests

hub-npu-format.test.ts: the link-to-NPU switch helper, plus the effect ordering in hub-page.tsx. npu-api.test.ts: the README note for main, a named branch, a commit SHA and no repo. Both fail on #17514's head without this.

Tested on Windows 11, Ryzen 9 9950X + 2x R9700, no NPU: frontend unit tests and typecheck. Not run on a Ryzen AI NPU.

Screenshots

NPU spoofed: fake Lemonade/FastFlowLM on a Windows 11 PC with no NPU; no speed numbers. Before | after: fork phase stack, phase 2 945ba98 | phase 3 3669e68. This PR's head ba683c6 is part of 3669e68. Light mode, mint theme, glass on, same on both sides.

Before | after: hub?npu=qwen3.5-9b-FLM opened on the Recommended filter switches to NPU and opens that card, with the "Latest on Hugging Face (may be newer than the installed files)" note; before, the link landed on the normal Hub.
17525

Also checked by building Unsloth Studio from this PR's merge base (left) and head (right), on the same spoofed AMD NPU:

Opening /hub?npu=qwen3.5-9b-FLM: the Hub switches to the NPU format and opens that model's card. Before (#17514 head), the link landed on the normal Hub.

Before and after

FastFlowLM's model_list.json names each model's Hugging Face repo (and,
for some, a pinned revision). The NPU catalog now carries it as hf_repo /
hf_revision, and the Hub's NPU list opens the same split detail pane GGUF
models get: repo link, base model, size, capabilities, max context, the
row's Download/Run/Delete, and the README at that revision.
…d NPU cards

A ?npu=<id> link only opened its card when the Hub's format filter was
already NPU; on any other filter the row was never selected and the
clearing effect dropped the param. The link now switches the current tab
to NPU once, before the param can be cleared.

FastFlowLM pins most repos by branch, and model_info.json's oids are
per-file blob hashes rather than a commit, so a card read from main can be
newer than the hash-checked files. Those cards now say so.
@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 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-13T18:09:39.460115Z c5ce658 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.

@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: 4c1e406e48

ℹ️ 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 +663 to +664
const npuListing =
showNpuCatalog && (!npuCatalog?.ready || npuModels === null);

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 Wait for catalog refresh before discarding an NPU link

When returning through browser history to an On Device NPU link after the target was downloaded in another client, the cached catalog row can still have downloaded: false. useNpuCatalog starts a refresh on activation but retains the cached array, so this expression reports that listing is finished and selectedNpu remains null. The cleanup effect consequently removes ?npu before the refresh completes; the subsequently updated row never opens its card. Track the active listing request and wait for it to finish before invalidating the link, rather than treating any non-null cached catalog as current.

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: it needs the model downloaded from another client and then a history navigation back to a stale On Device list. The refresh that activation starts updates the row, and the link can be reopened.

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 13, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: c5ce65834e

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

danielhanchen added a commit to LeoBorcherding/unsloth that referenced this pull request Nov 14, 2026
… the Hub (unslothai#17514)

In the Model Hub with the format set to NPU, FastFlowLM models were
plain rows with no detail view, while GGUF models open a pane with the
repo, base model, stats and README. Lemonade's `/v1/models` doesn't say
which Hugging Face repo a model comes from, so the Hub had nothing to
open.

FastFlowLM's `model_list.json` (beside the `flm` binary, already read
for resumable downloads) names each model's Hugging Face repo, and for
some a pinned revision such as `flm_q4k_high_precision`. The NPU catalog
now returns `hf_repo` and `hf_revision`, and clicking an NPU row opens
the same split pane GGUF models use: the FastFlowLM repo with copy and
open links, the base model from the card's metadata, size,
Vision/Reasoning/Tools, max context, the row's Download / Run / Delete
with progress, and the README at that revision. A model with no Hugging
Face repo shows "No model card for this model." The selection lives in
`?npu=` and closes when you leave the NPU list. GGUF behavior is
unchanged.

Not in scope: Q4NX exports made locally, which Unsloth Studio can't load
yet.

Tests: URL parsing in `test_flm_files.py` (bare repo, `/resolve/<rev>`,
non-HF URL, missing file), catalog rows carrying the repo in
`test_npu_backend.py` (run under WSL), API typing and helpers in
`npu-api.test.ts`, README revision fetching in
`hub-readme-revision.test.ts`. Typecheck clean.

Screenshots were taken on a spoofed NPU on a Windows desktop, not real
Ryzen AI hardware.

## Screenshots

NPU spoofed: fake Lemonade/FastFlowLM on a Windows 11 PC with no NPU; no
speed numbers. Before | after: fork phase stack, phase 2 `945ba98` |
phase 3 `3669e68`. This PR's head `0b15229` is part of `3669e68`. Light
mode, mint theme, glass on, same on both sides.

Before | after: clicking an NPU model in the Hub opens its Hugging Face
model card (FastFlowLM/Qwen3.5-4B-NPU2, base Qwen/Qwen3.5-4B); before,
nothing opened. The "Latest on Hugging Face" note above the README is
unslothai#17525.

![17514](https://raw.githubusercontent.com/LeoBorcherding/unsloth/213eeb5869056aa16d7170b41f6949f57ee3517a/npu-phases/phase-3/17514-hub-npu-card.png)

Also checked by building Unsloth Studio from this PR's merge base (left)
and head (right), on the same spoofed AMD NPU:

Model Hub, format NPU, clicking qwen3.5-9b-FLM: a detail pane opens with
the FastFlowLM repo, base model, size, context and README. Before, the
row opened nothing.

![Before and
after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/17514/pr17514_before_after-24e1edc37c33.png)

---------

Co-authored-by: Daniel Han <[email protected]>
@danielhanchen
danielhanchen merged commit 02765d7 into unslothai:main Nov 14, 2026
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