Repository navigation
[Bug] AMD NPU: hand-kept model lists drift from the installed FastFlowLM and converter (Qwen3 14B offered, LFM3 hidden) - #18050
Conversation
…d Q4NX converter, and the composer picker lists NPU models by name in the popular order
…names those rows like the Hub
…eir own PR; its NPU rows show the support tag
# Conflicts: # studio/backend/tests/test_export_npu_q4nx.py
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 |
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: 4da7136d36
ℹ️ 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".
| config.json, else its Hugging Face repo, cached on disk per model_list.json.""" | ||
| if flm_binary is None: | ||
| return None | ||
| listing_path = flm_binary.parent / "model_list.json" |
There was a problem hiding this comment.
Reuse the supported FastFlowLM manifest locator
On installations that keep manifests in share/flm rather than beside bin/flm, this hard-coded path returns None, even though that layout is already supported by npu_local_models.find_flm_list. Consequently, /api/npu/compat stays unknown and the replacement geometry gate skips validation for every export, allowing unsupported geometries such as Qwen3.5-122B-A10B to reach the converter's fixed 35B-A3B configuration. Use the shared manifest locator here and for the manifest stamp in current().
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in fa34949: flm_shapes and the cache stamp now use npu_local_models.find_flm_list, so a share/flm manifest is read.
| shapes = runnable.get(arch) | ||
| if not shapes: | ||
| raise RuntimeError( |
There was a problem hiding this comment.
Preserve the supported Nanbeige architecture alias
For a supported Nanbeige4.1-3B GGUF whose general.architecture is nanbeige, the compatibility table contains its (32, 2560, 0) geometry only under llama, so this new branch aborts the export. The pinned converter still lists nanbeige, and npu_local_models._FLM_BASES['nanbeige'] explicitly supports loading this shape; the previous gate also allowed this architecture through. Normalize the alias or emit an equivalent runtime row before interpreting a missing architecture key as a lack of kernels.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in fa34949: build_compat adds the Nanbeige llama shape under the nanbeige architecture too, so the export gate and the UI accept it.
| ? lower.includes("omni") || (matched.length > 0 ? matched.some((s) => s.converts) : !sized) | ||
| : !!converter && | ||
| (converter.architectures.includes(arch) || | ||
| converter.basenames.some((prefix) => repoName(lower).startsWith(prefix))); |
There was a problem hiding this comment.
Check the selected filename before refusing basename-routed models
For a valid Qwen2.5-VL-3B GGUF in a renamed Hub repository, the card can pass acme/vision-GGUF Qwen2.5-VL-3B-Instruct-Q4_0.gguf, but repoName() discards the selected filename and tests only vision-GGUF. This reports converts=false, causing q4nxArchFit to return unsupported and disable Convert even when the GGUF retains a supported general.basename. Check the available filename evidence, or leave conversion unknown, rather than making the Hub repository name a conversion requirement.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in fa34949: basename routing now checks every name passed (repo id and file), so a renamed repo with a Qwen2.5-VL file converts.
…lama shape, check file names for basename routing [skip ci]
|
@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: fa349490c7
ℹ️ 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".
| const matched = shapes.filter((s) => s.sizes.some((size) => namesSize(lower, size))); | ||
| const sized = matched.length > 0 || NAMED_SIZE.test(lower); |
There was a problem hiding this comment.
Account for rounded catalog size aliases before rejecting a model
For a supported Phi-4-mini GGUF whose repository or selected filename includes 3.8B, matched is empty because FastFlowLM labels the same (32, 3072, 0) model phi4-mini-it:4b. NAMED_SIZE then makes sized true, causing npuFit to report convertOnly; q4nxArchFit turns that into unsupported and disables Convert even though the backend accepts its geometry. Treat rounded catalog sizes as aliases, or leave an unmatched size unknown until the GGUF geometry is checked, rather than treating an exact token mismatch as proof of missing kernels.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this: real Phi-4-mini GGUF repos and files (unsloth/Phi-4-mini-instruct-GGUF and the like) carry no size token, so they reach the shapes-only path. Matching sizes exactly is what lets the tag tell 14B apart from 8B.
| .map((r) => ({ r, fit: q4nxArchFit(r.ggufArchitecture, r.id, npuCompat) })) | ||
| // "Not supported" is left out; a model that runs or only converts stays, tagged. | ||
| .filter(({ fit }) => fit.tag !== "unsupported") |
There was a problem hiding this comment.
Retain basename-routed search results until filenames are available
For a generic Hub search returning a supported Qwen2.5-VL-3B GGUF from a renamed repository such as acme/vision-GGUF, this call receives only the repository ID and returns tag: "unsupported", so the filter removes the model before its files can be selected. Although selected-filename matching is fixed, this search path still passes only r.id; passing the supported filename later cannot restore a result that was already filtered out. Preserve basename-dependent results as unknown until filename evidence is available instead of hiding them.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this: a Qwen2.5-VL GGUF in a repo renamed to drop its model name is an edge case, and the selected-file path already reads the file name. Hiding search rows that only a file name could rescue keeps the list honest for every normally named repo.
| export function useNpuCompat(active = true): NpuCompat | null { | ||
| const [compat, setCompat] = useState<NpuCompat | null>(cached); | ||
| useEffect(() => { | ||
| if (!active || cached) return; |
There was a problem hiding this comment.
Refresh cached compatibility after a runtime upgrade
If Export reads compatibility before Model Hub performs its existing deferred runtime upgrade (useNpuCatalog → refreshNpuModels → NpuBackend._ensure_running), the first successful table remains cached for the entire frontend session. This guard prevents even remounting Export from requesting the updated table, so the backend's manifest-stamp invalidation is never observed and newly supported models remain disabled or hidden until a full page reload. Invalidate or version this cache when NPU status reports a changed FastFlowLM version.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 33f3fe9: the hook re-reads the table on every mount (the backend memoizes per installed FastFlowLM), so an upgrade shows without a reload.
…hows without a reload [skip ci]
|
@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: 33f3fe9666
ℹ️ 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".
| if not arch or runnable is None or (arch == "qwen35" and any("omni" in n for n in names)): | ||
| return |
There was a problem hiding this comment.
Preserve fixed-config geometry checks when the catalog is unreadable
On a supported, ready NPU with an incomplete shape cache, a single unavailable catalog config (offline or an HTTP error) makes flm_shapes() return None, so this branch bypasses every geometry check even though FastFlowLM is installed. Using the fixture manifest with only LFM3's config unavailable lets a qwen35moe GGUF with geometry (48, 3072, 256) pass; fetching that unrelated config makes the same input fail. This reopens the unsupported 122B-A10B path into the converter's fixed 35B-A3B configuration, potentially producing an invalid export instead of refusing it. Preserve converter geometry validation, or refuse an unverified fixed-config model, when runtime compatibility is unknown.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 33f3fe9: when FastFlowLM's table is unknown, qwen35moe (the one architecture the converter configures by name alone) is still held to the 35B-A3B shape, so 122B-A10B is refused as before.
… is unknown [skip ci]
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! 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". |
## 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.
NPU model support now comes from what is installed instead of hand-kept lists:
GET /api/npu/compat(core/inference/npu_compat.py) reads FastFlowLM'smodel_list.json, each catalog model'sconfig.json(downloaded copy, else its Hugging Face repo, cached per listing) for layers / hidden size / experts, and the pinned Q4NX converters'ModelArchNamesand_QWEN35_GEOMETRY, parsed withastand never imported. It never starts the runtime.Q4NX_ARCHITECTURES/Q4NX_SIZES(frontend) and_NPU_SHAPES(backend export guard).NPU_POPULAR, six checkpoints, replaces [Feature] AMD NPU: list new models that run on a Ryzen AI laptop first in the picker and Hub #17513's recommended list as the one order every NPU list uses.npuDisplayNameand orders Discover's NPU rows withnpuRowsFor.Base
mirror-base/npu-compatis upstream main at a2b1f68.Screenshots
Composer model picker, On Device tab. Both Studios were built from source (left: the merge base, right: this PR). The
/api/npu/*answers come from a real Strix Halo XDNA2 capture and the FastFlowLM 1.0.12 compat table. Each NPU row now shows its support tag ("Runs on NPU").Without a supported NPU,
GET /api/npu/compatreturns an all-unknown table and installs and fetches nothing (checked on a CPU host and on a Colab T4).