Repository navigation
Studio NPU: read the FastFlowLM model list when flm prints more after it - #18806
Merged
danielhanchen merged 4 commits intoNov 23, 2026
Merged
danielhanchen merged 4 commits into
danielhanchen merged 4 commits into
Conversation
flm_host joined flm list --json stdout and stderr and parsed everything after the first brace, so any line flm printed after the JSON failed the whole NPU model list with "Extra data: line N column 1". Read just the JSON object that holds "models" and skip text around it. Fixes unslothai#18763
danielhanchen
added a commit
that referenced
this pull request
Nov 21, 2026
…p dunders spreading the decode-rewrap scan (#18815) ## Problem `(Python 3.13, diffusion)` fails on `main` and on every PR based on it (for example #18806) with two failures: ``` test_diffusion_family_data_freeze.py::test_family_data_resolves_identically AssertionError: tables test_diffusion_vae_oom.py::test_every_decode_rewrap_site_restores_the_oom_scope 510 sites flagged, first ('diffusion.py', 'DiffusionBackend.__init__') ``` Both reproduce locally on `main` (`d8ff4de6a1`). Running both tests on each Studio inference commit since the last green `main` attributes them: | commit | freeze | decode rewrap | |---|---|---| | `8d41610c50` (#18800) | pass | pass | | `d66aa77cee` (#18779) | fail | pass | | `6f4c2a7bd9` (#18780) | fail | fail | ## Causes **Family data freeze (#18779).** #18779 adds the dense FastWan students as trusted video repos. The frozen table was not regenerated, so the only difference is two new `trusted_video_repos` entries, `fastvideo/fastwan2.1-t2v-1.3b-diffusers` and `fastvideo/fastwan2.2-ti2v-5b-fullattn-diffusers`. The PR is right; the fixture is behind. **Decode-rewrap scan (#18780).** The test seeds every function that assigns `.decode`, then marks any function that calls one of those *by bare name* as a rewrap helper too, to a fixpoint. #18780's opt-in draft decode is a context manager, `TinyVaeDraftDecode`, which swaps `vae.decode` in `__enter__` and restores it in `__exit__`. That made `__enter__` and `__exit__` seeds, and a bare-name match on `__exit__` / `__enter__` reaches every function that drives any context manager by hand, so the fixpoint spread to 510 functions. The draft swap itself is scoped and restores the previous `decode` on exit, and its fallback calls the decode it replaced, so the OOM scope is intact. The PR is right; the scan's name matching is too loose for dunders. ## Fix Test-only: - `tests/fixtures/diffusion_family_data_freeze.json`: regenerated with `UNSLOTH_FREEZE_UPDATE=1`. The diff is exactly the two FastWan repos (2 lines added). - `test_every_decode_rewrap_site_restores_the_oom_scope`: dunder method names are not propagated by name. A dunder is reached through `with` or an object protocol, never by a call to that name, so matching it by name cannot identify a caller. Named helpers such as `install_untiled_decode` still propagate as before. ## Verification - `test_diffusion_family_data_freeze.py`, `test_diffusion_vae_oom.py`, `test_video_tiny_vae.py`, `test_video_tiny_vae_wiring.py`: 134 passed, 5 skipped. - Sabotage: adding `def _sabotage_leak(vae): install_untiled_decode(vae)` to `video.py` fails the rewrap test with `[('video.py', '_sabotage_leak')]`, so a real unguarded rewrap is still caught. Restored afterwards. - The freeze fails on `main` without the regenerated fixture, as on CI.
Member
|
@codex review |
1 similar comment
Member
|
@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: 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". |
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.
Related to #18763
What this changes
Since #18554, Studio lists NPU models through
flm_host.pyon Windows and Linux.Flm.catalog()ranflm list --json, joined stdout and stderr, and passed everything from the first{tojson.loads. When flm prints anything after the JSON (a runtime notice on stderr, a status line on stdout),json.loadsraisesExtra data: line N column 1, and the whole NPU model list fails with that message, as in the report (v0.1.922, FastFlowLM 1.0.13).catalog()now reads only the JSON object that holdsmodels(json.JSONDecoder().raw_decode, tried at the first brace and at braces that start a line) and skips the text around it. If no such object is found, the error names flm's output (flm list failed: ...) instead of a JSON parser position.Tests
test_npu_flm_host.py: the model list with a line after it on stderr, a line after it on stdout, and a status line before it; a truncated list reports flm's output.flm.exeprinting the FastFlowLM 1.0.13 model list (rebuilt from itsmodel_list.jsonthe wayflm list --jsondumps it) followed by one stderr line. Only the NPU hardware probe was replaced; Studio started the realflm_host.pyprocess andGET /api/npu/modelswent throughroutes/npu.py.409 Listing NPU models failed: Extra data: line 2580 column 1 (char 93218)200, 45 chat modelstest_npu_flm_host.py+test_npu_backend.py: 28 passed with this change, 24 on main (test_npu_backend.pyis skipped on Windows).Not tested on a real Ryzen AI NPU or on Linux.
Maintainer validation (AMD CI, real Strix Halo NPU)
Ran on the gfx1151 pool with the pinned FastFlowLM 1.0.13 (
flm list --json,validate,version) andFlm.catalog()at main versus this branch:/dev/accel/accel0flm serveholding the NPUvalidatereadyOn these hosts flm prints nothing around the JSON, so they list on main too and this is a no-regression check. The reporter's error offset (line 2025, char 73430) is exactly the end of the 1.0.13 model list JSON with 7 models installed, so the failure is text printed after the list, which this change skips.