Repository navigation
[Feature] AMD NPU: all NPU PRs and follow-ups stacked for testing together - #17519
Closed
LeoBorcherding wants to merge 147 commits into
Closed
LeoBorcherding wants to merge 147 commits into
LeoBorcherding wants to merge 147 commits into
Conversation
When a FastFlowLM load or NPU chat failed, Unsloth Studio kept only Lemonade's one-line summary and left everything lemond printed at debug. Log what lemond printed since the request started at warning on failure, and add its first error line the summary does not already say to the error the user sees.
The NPU list followed the backend's alphabetical order, so d3 and Gemma sat above Qwen3.8 and Qwen3.6. Qwen models now lead, newest version first, and everything else keeps the backend's order after them.
…cker The NPU list in the model picker ended with the runtime versions, which is noise in a model chooser. The Hub's NPU list still shows them.
…Logs Each lemond start writes logs/lemonade/lemonade-<epoch>-port-<port>.log beside the llama-server logs, pruned the same way, so a failed NPU load can be read in full from the Logs page instead of only the lines tailed into the server log.
… Strix laptop Newest-Qwen-first put qwen3.6-moe 35B-A3B and qwen3.8 27B at the top, which fail to load or take hours to download on a Ryzen AI laptop. Recommend qwen3.5 9B/4B, Gemma 4, gpt-oss, LFM3 and the other new small models first; the rest keep Lemonade's order.
Under the All filter, the model picker ended with a thin 12px strip pressed against the panel's rounded bottom edge. It is now a pill row like the models above it, with the same hover and focus treatment and room below it. The 8px gap above it is unchanged, so the floating Eject button keeps its place.
…machines Engines named llama.cpp, whisper.cpp, audio.cpp and MLX, but not the runtimes behind AMD Ryzen AI NPU chat. The section now shows FastFlowLM and Lemonade with the versions /api/npu/status already reports, only where the NPU runtime is installed, read-only like MLX. Labels added to every locale.
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.
… shared RAM On a carve-out APU the driver pool is the BIOS carve-out plus WDDM shared memory, and that shared part is system RAM the RAM tile already counts. The VRAM tile, device row and floating monitor now divide usage by the carve-out and show the RAM the GPU can still borrow on its own line, capped by free RAM. The GGUF row names the llama.cpp build and drops the 'Shared system RAM' label from a budget that is mostly the carve-out.
…outgrows With no qualifying carve-out (a 2 GiB UMA slice with 34 GiB shared), the VRAM tile fell back to the combined pool as bare VRAM. It keeps main's split label there again; only a carve-out at least as large as its shared part reads as the carve-out alone.
…size run settings FastFlowLM tuning for AMD NPU models under Advanced settings, sent to Lemonade as the flm_args recipe option. Each persists like any run setting (saved sets, Always load, the server-shared override) and a change makes /load reload instead of answering already_loaded.
Auto now picks the largest context whose bf16 KV cache (full-attention layers only, read from FastFlowLM's config.json) plus FastFlowLM's prefix cache fits the RAM left after the weights and a 2 GiB headroom, up to 65536 or the model's limit, never below 8192. A missing config.json keeps 8192. Pins still win; one above the estimate is logged and flagged in the run settings.
The Q4NX convert card took a repo, a file and a base model as free text. It now searches GGUF repos on the Hub (or lists the on-device GGUF models), lists the repo's .gguf files with Q4_0, Q4_1 and Q4_K_M first and the rest marked as re-quantized, fills the original model from the card's base_model, hides Hub repos whose GGUF architecture the pinned converter does not map, and notes when the architecture is unknown until conversion.
…usage beside a discrete card
The Lemonade log now carries Unsloth Studio's side: the lemond command it started, each load with its context size, and how a failed request ended. The server-log warning is a structured record naming the Lemonade log file instead of a plain multi-line string.
Settings > System > Live monitor and the floating monitor get an NPU card when /api/npu/status reports a supported XDNA 2 NPU: the device, its driver, and the NPU model resident in system RAM. On Windows /api/system now reports npu_load_percent from the GPU Engine counters of the NPU's own adapter, matched by the LUID its PnP node carries; Linux has no counter for it, so the card shows no load there.
This was referenced Nov 11, 2026
# Conflicts: # studio/backend/core/inference/npu_backend.py
An unreadable shared iGPU now sits under Shared with system RAM, but it has no free reading, so the VRAM tile and the floating monitor printed a dangling 'Estimated available: Unknown'. Keep the label and drop the estimate line when nothing reports free memory.
…nto studio/npu-stack-all # Conflicts: # studio/frontend/src/components/floating-monitor.tsx # studio/frontend/src/features/settings/tabs/resources-tab.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All eleven AMD NPU PRs plus four follow-ups merged onto main in one branch, so the whole NPU experience can be tried and reviewed together. Draft: review and merge the individual PRs; this one is for testing them as a set.
?npu=links open the NPU model, and the card notes its pinned revisionMerge notes, beyond the plain merges:
[Feature] AMD NPU: power mode, prefill chunk length and image pre-resize in model settings #17510 x [Feature] AMD NPU: size the context to free RAM instead of a flat 8192 tokens #17511 x [Feature] AMD NPU: write Lemonade's output to its own log like llama-server, and show why a model failed to load #17512 in
npu_backend.pyload(): kept the Lemonade log note and output mark,flm_args, and the fitted context together./api/inference/statusreports bothflm_argsand the fitted max context.model-config-page.tsx: the advanced settings toggle shows for NPU models ([Feature] AMD NPU: power mode, prefill chunk length and image pre-resize in model settings #17510) with [Feature] AMD NPU: size the context to free RAM instead of a flat 8192 tokens #17511's over-estimate warning above it.[Feature] AMD NPU: drop the FastFlowLM / Lemonade version line from the model picker and Hub #17506 x [Feature] AMD NPU: list new models that run on a Ryzen AI laptop first in the picker and Hub #17513: the runtime version line stays dropped; the capability and context labels stay.
The fake servers in [Feature] AMD NPU: power mode, prefill chunk length and image pre-resize in model settings #17510's and [Feature] AMD NPU: size the context to free RAM instead of a flat 8192 tokens #17511's tests gained
note()/output_mark(), which [Feature] AMD NPU: write Lemonade's output to its own log like llama-server, and show why a model failed to load #17512'sload()now calls. Whichever of those lands after [Feature] AMD NPU: write Lemonade's output to its own log like llama-server, and show why a model failed to load #17512 needs the same two lines.[Bug] AMD NPU: models larger than the memory the NPU can map download fully, then fail at load with no warning #17531 in the Hub list and NPU detail pane: the fit warning sits under the row details, and Run warns first. [Feature] AMD NPU: large model downloads check free disk space first, can be cancelled and resumed, refuse a second Unsloth Studio process, and show Verifying/Finishing instead of a frozen 99% #17526's Cancel button and download phases are kept beside it.
[Bug] AMD NPU: Q4NX export accepts any model of a supported architecture, so Llama 3.3 70B, Gemma 4 26B-A4B and Qwen3.5-122B convert into files FastFlowLM can't run #17533 x [Bug] AMD NPU: Q4NX export parses the whole GGUF vocab twice before converting and re-quantizes Q4_K_M even when Q4_0/Q4_1 was also exported, on every non-Qwen3.5 model #17534 in
q4nx.py: one header walk that skips the vocab arrays feeds both the geometry gate and the source pick; the gate still runs before the converter is installed.Checked at
0b27683on Windows 11, Ryzen 9 9950X + 2x R9700, no NPU: frontend typecheck clean (with tests),npm run buildsucceeds, 109 NPU/Hub/title/export frontend tests pass, backend NPU + FastFlowLM download + Q4NX + log tests 276 passed; the 12 failures are symlink setups intest_npu_detect,test_export_npu_q4nxandtest_export_q4nx_accounts(WinError 1314: this box has no symlink privilege). Not run on a Ryzen AI NPU yet.Testing Qwen3.8-27B and Qwen3.6-35B MoE on a Ryzen AI NPU
Both fail on a Strix laptop and nothing in the code explains it yet: the 27B download (18 GB) never finished, and the 35B MoE (22 GB) fails to load every time. Lemonade hides FastFlowLM's own error unless it runs at debug (lemonade-sdk/lemonade#4131), so this run is to get the real reason.
ls /dev/accel/showsaccel0, andlsmod | grep amdxdnalists the driver.git clone -b studio/npu-stack-all https://github.com/LeoBorcherding/unsloth && cd unsloth && bash install.sh --local, thenunsloth studio -p 8888.qwen3.8-mtp-27b-FLM(orqwen3.8-dflash2-27b-FLM, the faster variant) andqwen3.6-moe-35b-a3b-FLM, with context left on Auto. Search and Code now start off on NPU models; leave them off for the speed check, then turn one on to see the difference in tok/s. Note free disk before the 27B download (df -h ~).lemonade-*.logfile.qwen3.8-mtp:27b. Iffindcomes back empty, sendls -R ~/.unsloth/studio/lemonade/cache/bin.Please send: the error text, the
lemonade-*.log, theflmoutput,free -ganddf -h ~.Expected: Qwen3.8-27B (both
-mtpand-dflash2) stays capped at 8192 tokens (#13525, FastFlowLM side ROCm/FastFlowLM#1001); other NPU models now size their context to free RAM (#17511).