Repository navigation
MLX inference test stub: accept any arguments a zoo helper is called with - #12700
Merged
Merged
Conversation
…with unsloth_zoo #1546 calls nax_quantized_linear(model, int8_prefill) inside generation_mode. The stub answered unknown helpers with contextlib.nullcontext, which takes one argument, so every real-model vision batch test on the Mac MLX job raised TypeError in nullcontext.__init__. The stub now hands out a scope that accepts any arguments and yields the model, for the fused_* names too. Two new tests pin it: one calls every stub scope with the shapes zoo uses, and one reads zoo's own calls to its mlx.inference helpers and replays each one's arguments against the stub, so the next added argument fails on Linux as well.
Member
Author
|
@codex review |
Codex Review SummaryThis 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. |
This was referenced Oct 4, 2026
|
Codex Review: Didn't find any major issues. Another round soon, please! 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". |
danielhanchen
added a commit
that referenced
this pull request
Oct 6, 2026
…#12783) * MLX backend tests: answer zoo's _fusion_modules in the inference stub unsloth_zoo #1565 made mlx/generate.py import _fusion_modules from mlx.inference and call tuple(_fusion_modules(model, None)). The stub refuses private names, so the guard added in #12700 failed on Linux (the stub cannot answer _fusion_modules) and every macOS vision test raised ImportError in the dispatch job (#12778). It is a plain function, not a scope, so the stub carries zoo's three-line body in PLAIN_HELPERS, the call-shape replay calls it instead of entering it, and a new test fails if the copy drifts from zoo's body. * MLX stub body check: drop only a leading docstring before comparing Filtering every ast.Expr also hid bare calls, so zoo adding a log line or other call to _fusion_modules would have passed. Only a leading string literal is ignored now.
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.
Problem
MLX CI on Mac M1fails on PRs based on current main (seen on #12699):unsloth-zoo #1546 (merged 10:27 UTC today) changed
generation_modeto enternax_quantized_linear(model, int8_prefill). The zoo call is correct; this is a new argument on a zoo helper. The Studio test stub,_neutral_zoo_helperfrom #12548, answered every unknownunsloth_zoo.mlx.inferencehelper withcontextlib.nullcontext, and that takes one argument, so the stub broke on the second one.Fix
tests/test_mlx_inference_backend.pyonly:_neutral_scope(model=None, *args, **kwargs)returnsnullcontext(model). The stub hands it out for unknown helpers and for the explicitfused_*names, so a scope still yields the model and an added argument is ignored. Deleted fusions still raiseImportErroras before.test_every_stub_scope_takes_any_arguments_and_yields_the_modelcalls every stub scope with no arguments,(model),(model, flag)and(model, int8_prefill=...).test_the_stub_accepts_every_call_zoo_makes_to_an_inference_helperparses zoo'smlx/*.py, finds each call to a helper zoo imports frommlx.inference, and replays the same positional and keyword shape against the stub. The next argument zoo adds then fails on the Linux backend job too, not only on the Mac job.Verification
nullcontextthey fail in 3 cases, including the zoo-call replay that hitsnax_quantized_linear(model, int8_prefill).