Skip to content

[Feature] AMD NPU: open the Hugging Face model card for NPU models in the Hub - #17514

Merged
danielhanchen merged 5 commits into
unslothai:mainfrom
LeoBorcherding:studio/npu-model-cards
Nov 14, 2026
Merged

danielhanchen merged 5 commits into
unslothai:mainfrom
LeoBorcherding:studio/npu-model-cards

Conversation

@LeoBorcherding

@LeoBorcherding LeoBorcherding commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

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 #17525.
17514

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

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.
@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

Screenshots of this PR's change:

Hub, NPU filter, qwen3.5-9b-FLM selected: the Hugging Face card for FastFlowLM/Qwen3.5-9B-NPU2 with NPU, Vision, Reasoning, Tools and the base model.

17514-hub-npu-model-card.png
Taken on Windows 11 (Ryzen 9 9950X + 2x R9700, no NPU) with a spoofed NPU: a fake Lemonade 2026.44.1 + FastFlowLM 1.0.12 that answers Unsloth Studio's API, running the stacked branch #17519 at e8d25a4. It shows the UI; it is not a run on a Ryzen AI NPU.

@danielhanchen danielhanchen self-assigned this Nov 13, 2026
danielhanchen added a commit to LeoBorcherding/unsloth that referenced this pull request Nov 13, 2026
danielhanchen added a commit to LeoBorcherding/unsloth that referenced this pull request Nov 13, 2026
…play-names

# Conflicts:
#	studio/frontend/src/features/hub/catalog/npu-catalog-list.tsx
#	studio/frontend/src/features/hub/hub-page.tsx
@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:28.048504Z 0e0751e 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: 3869eb6049

ℹ️ 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 +671 to +674
if (!urlNpu || selectedNpu || npuStatus === null || npuListing) return;
void navigate({
to: "/hub",
search: (prev) => ({ ...prev, npu: undefined }),

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 Restore the NPU format before clearing a URL selection

When a valid /hub?npu=<model-id> URL is reloaded or opened directly, discoverFormat initializes to recommended and downloadedFormat to all; neither is restored from hubSearch.npu. Consequently, showNpuCatalog is false even on a supported, ready machine, and this effect deletes the selection as soon as NPU status resolves. The new URL-backed model-card selection therefore cannot survive a reload or reopen from a saved link. Restore the appropriate NPU format from the URL before treating the missing selection as evidence that the user left the NPU list.

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.

Restoring the NPU format from ?npu is #17525's scope, which stacks on this PR and switches the format before deciding the selection is gone; this PR only makes the card selection URL-backed.

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. 👍

Reviewed commit: 0e0751e990

ℹ️ 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
danielhanchen merged commit c4bc5a1 into unslothai:main Nov 14, 2026
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 14, 2026
…ormat filter is already NPU, and the card's README can be newer than the installed files (unslothai#17525)

Stacks on unslothai#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 unslothai#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](https://raw.githubusercontent.com/LeoBorcherding/unsloth/213eeb5869056aa16d7170b41f6949f57ee3517a/npu-phases/phase-3/17525-hub-npu-link.png)

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 (unslothai#17514 head), the link landed on the
normal Hub.

![Before and
after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/17525/pr17525_before_after-0a6af91bb026.png)

---------

Co-authored-by: Daniel Han <[email protected]>
Co-authored-by: Daniel Han <[email protected]>
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 14, 2026
… of the Lemonade ID (unslothai#17610)

NPU models showed up under their Lemonade ID, e.g.
`qwen3.6-moe-35b-a3b-FLM`, a name nobody searches for and that doesn't
match anything on Hugging Face. They now show as their Hugging Face
repo, `Qwen3.6-35B-A3B-NPU2`, the same name as on [FastFlowLM's HF
page](https://huggingface.co/FastFlowLM).

**Display only.** Model IDs, API calls, saved run settings and
loaded-model state all still use the Lemonade ID. Searching the picker
by the old ID still finds the model.

Where the new name shows:
- Model picker, NPU section, and the selected-model chip
- Run settings header
- Hub NPU list
- Loaded-models list

**Depends on unslothai#17514.** The HF repo comes from the `hf_repo` field that
unslothai#17514 adds to the NPU catalog. Without it, every NPU model keeps its
Lemonade ID, so this PR merges safely in either order.

If listing the NPU catalog fails, names fall back to the Lemonade ID,
and the lookup tries again after 30 s instead of staying stuck for the
rest of the session.

**Tests:** `npu-display-name.test.ts` (new) covers the name mapping, the
fallback and the retry. `npu-api` and `npu-catalog-store` tests updated.
`tsc --noEmit` clean.

**Not tested here:** no Ryzen AI NPU on this machine. The new names on a
real NPU get checked in the blog stills rerun on the AMD DevLab Strix
Halo runner, once this is in the NPU stack. Screenshots will be added
after that.

## Screenshots

Before (left) and after (right), Unsloth Studio built from each side on
the same spoofed AMD NPU.

Model Hub, format NPU: rows read the Hugging Face model names with the
FastFlowLM owner instead of Lemonade ids. Before is unslothai#17514 head.

![Before and
after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/17610/pr17610_before_after-4668db44c155.png)

---------

Co-authored-by: Daniel Han <[email protected]>
Co-authored-by: Daniel Han <[email protected]>
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