Repository navigation
[Bug] AMD NPU: a failed model load hides FastFlowLM's own error, so the user only sees "Failed to load X model!" - #17539
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
… overlaps an NPU load
A refused request no longer marks a running load's output window as shared, which hid FastFlowLM's load error for the rest of that load.
…out, and point a silent NPU failure at the Logs page
The proxy's own preflight (an MCP image, a video, the confirm gate) could still refuse a request after the window opened, marking a running load's window as shared. The window now opens at the first read of the upstream stream.
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 |
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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 67f8fdf5bc
ℹ️ 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 window is not None and not window.shared: | ||
| return True |
There was a problem hiding this comment.
Fence buffered chat output before opening load capture
If a chat finishes while lemond-drain is behind, its output window can disappear while its (Process) request-preview lines are still buffered. A subsequent load then gets an unshared window, and this unconditional acceptance writes the previous chat's prompt into the Lemonade log; a failed load can also copy it into the server warning. This occurs without overlapping requests or a forged log prefix. Synchronize capture with a boundary consumed by the drain rather than treating request-window lifetime as a stdout boundary.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this: it needs the drain thread to lag behind a finished chat and a load to start inside that lag, and the line lands only in the user's own local Lemonade log.
| except LemonadeUnavailable as exc: | ||
| self._raise_if_load_cancelled(model_id) | ||
| raise NpuError(f"Loading {model_id} failed: {exc}") from exc | ||
| reason = self.explain_failure(window, str(exc)) |
There was a problem hiding this comment.
Explain transport failures before closing the capture window
If /v1/load disconnects or times out while lemond remains alive and the drain still has FastFlowLM's failure queued, backend_output exits before this handler runs. Its cleanup clears _load_window, causing _keeps to discard the delayed (Process) error before explain_failure's settling wait can inspect it. The user receives only the transport error, and the underlying reason is missing even from the Lemonade log. Explain the transport exception inside the capture context, or drain the pending failure output before closing capture.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this: a /v1/load disconnect or timeout with lemond still alive is a degraded path; the user still gets the transport error, and the next load attempt captures FastFlowLM's reason.
|
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. 🎉 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. Delightful! 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]
Stacks on #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 #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/setfor the duration of one/v1/loadand 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: infois pinned in the config, since/internal/setsaves 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.pyfeeds 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.