Repository navigation
[Feature] AMD NPU: write Lemonade's output to its own log like llama-server, and show why a model failed to load - #17512
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.
…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.
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.
…ose the log on a failed start
A refused request (ours, or the proxy's own preflight: an MCP image, a video, the confirm gate) no longer opens a window, which marked a running load's window as shared and hid FastFlowLM's load error. The window now opens at the first read of the upstream stream.
…e log, and keep catalog output off a chat
…or-reasons # Conflicts: # studio/backend/core/inference/lemonade_server.py # studio/backend/routes/inference.py # studio/backend/tests/test_npu_chat_route.py # studio/backend/tests/test_npu_failure_output.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: Didn't find any major issues. You're on a roll. 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: Didn't find any major issues. What shall we delve into next? 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". |
# Conflicts: # studio/backend/core/inference/npu_backend.py [skip ci]
…he user only sees "Failed to load X model!" (unslothai#17539) Stacks on unslothai#17512; the diff here also shows its commits until it merges. When an NPU model fails to load, Lemonade answers `Failed to load <model> model!` and nothing else. FastFlowLM does print the reason, but lemond only relays a backend's output when the backend was started at debug (lemonade-sdk/lemonade#4131), so unslothai#17512's reason lookup only ever sees lemond's generic lines. Running lemond at debug all the time isn't an option: it logs chat content at that level, and flm prints part of every request body. So lemond is switched to debug over `/internal/set` for the duration of one `/v1/load` and back to info after. Outside a load, the relayed backend lines and any debug lines are dropped before they reach the Lemonade log or the tail. A load that overlaps a chat stays at info. `log_level: info` is pinned in the config, since `/internal/set` saves what it's given. Known FastFlowLM failures also get one line of advice after the raw line: NPU out of memory (ROCm/FastFlowLM#904), no hardware context (`CREATE_HWCTX`), model files from an older FastFlowLM (ROCm/FastFlowLM#685), and flm.exe blocked by Smart App Control (`0xC0E90002`, ROCm/FastFlowLM#973). No UI changes. Known limit: lemond writes debug message content raw onto the same stdout as its own records. If a chat joins while a load is in flight, and its content has a line that itself starts with a complete lemond log prefix (date, time, `[Info] (Tag)`), that line is kept in the local Lemonade log. Telling the two apart needs lemond to forward backend output without debug (lemonade-sdk/lemonade#4131). ## Tests `tests/test_npu_failure_output.py` feeds lemond's and flm's lines through `_drain`: each known failure gets its advice after the raw line, an unknown one gets none, flm output is kept only during a load, chat content stays out of the log when a chat overlaps a load or either level change, and a restart never inherits debug. Tested on Windows 11, Ryzen 9 9950X + 2x R9700, no NPU: the unit tests above, with lemond and flm output simulated. The matched strings come from FastFlowLM's source and the linked issues, not from a failure reproduced here. Not run on a Ryzen AI NPU. --------- Co-authored-by: imagineer99 <[email protected]> Co-authored-by: Daniel Han <[email protected]> Co-authored-by: Daniel Han <[email protected]>
When a FastFlowLM model failed to load on the AMD NPU, from the model picker or from chat, Unsloth Studio / Desktop showed only Lemonade's one-line summary, for example "Failed to load qwen3.6-moe:35b-a3b model!". The backend log had the same line as a
lemonade SSE error eventwarning, and everything lemond printed about the failure was logged at debug only, so nobody could tell whether it was memory, context size, the driver or a bad download.The fix
logs/lemonade/lemonade-<epoch>-port-<port>.log, pruned like the llama-server logs, and Settings > Logs lists it under a newlemonadefamily. A failed NPU load can be read in full there.Known limit: at the pinned Lemonade (v2026.44.1), FastFlowLM's own console output goes to NUL unless lemond runs at debug (fastflowlm_server.cpp#L226, process_windows.cpp#L270-L279). This PR doesn't switch lemond to debug: at that level it also logs message-content previews and starts
flm pullwith inherited console handles on Windows. So a reason only FastFlowLM prints (such as running out of NPU memory) still doesn't reach Unsloth Studio. Filed upstream as lemonade-sdk/lemonade#4131.How it was tested
tests/test_npu_failure_output.pycovers a failed/v1/loadand a failed NPU chat (streaming and JSON), the per-start log file and its listing in Settings > Logs;test_npu_chat_route.pygains the chat cases. The new tests fail on main and pass here.test_log_bounds.pyknows the new family and its pruning.test_npu_backend.pyis POSIX-only and passes under WSL).Not tested: no run on a Ryzen AI NPU, so lemond's real output for a failed FastFlowLM load isn't captured. The console format comes from Lemonade's
LOG_FORMAT, not a live log.Screenshots
NPU spoofed: fake Lemonade/FastFlowLM on a Windows 11 PC with no NPU; no speed numbers. Before | after: fork phase stack, phase-0 base
5d5c138| phase 1ac3e06e. This PR's headdddfe69is part ofac3e06e. Light mode, mint theme, glass on, same on both sides.Before | after: a failed load of qwen3.8-mtp-27b-FLM now adds lemond's reason ("FastFlowLM process has terminated with exit code 1") to the bare "Failed to load" toast.

After only (the base has no Lemonade log): Settings > Logs lists Lemonade's own log, filtered here to that failed load.
