Repository navigation
Lift for_inference's tensor parallel helpers in the return-logits test - #15162
Merged
Merged
Conversation
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. |
danielhanchen
added a commit
that referenced
this pull request
Oct 24, 2026
## Summary `tests/test_block_cudagraphs_clone.py::test_new_shapes_past_the_cap_skip_graphs`, added by #15154, fails in the `Repo tests (CPU, rest)` shard (for example #15162): ``` tests/test_block_cudagraphs_clone.py:108: in test_new_shapes_past_the_cap_skip_graphs assert step(16) == {"graphs"} E AssertionError: assert set() == {'graphs'} ``` That shard runs with `UNSLOTH_COMPILE_DISABLE=1`. The wrapped block's `forward` checks `_enabled()` on every call and takes the eager path when the kill switch is set. So the fake `torch.compile` the test installs is never called, and it records no call. The product is right: the kill switch is supposed to win. The test assumed compile was on. It passes locally with the variable unset and fails with it set to `1`. ## Change - Same autouse fixture as `tests/test_block_compile.py`: clear `UNSLOTH_BLOCK_COMPILE`, `UNSLOTH_COMPILE_DISABLE` and `UNSLOTH_FORCE_FLOAT32` for each test. - The layer/step setup moved into `_cap_layer_step()`, so a second test can use it. - `test_compile_disable_still_bypasses_the_block`: sets the kill switch after the block is wrapped and checks that the next call skips the compiled path. This pins down the behaviour the old test tripped over. ## Verification - `UNSLOTH_COMPILE_DISABLE=0` and `=1`: `6 passed` both ways. On main the `=1` case is `1 failed, 4 passed`. - Sabotage 1: with the fixture not autouse, under `UNSLOTH_COMPILE_DISABLE=1`, `test_new_shapes_past_the_cap_skip_graphs` fails again with the CI error. - Sabotage 2: with the `_enabled()` check removed from the block's `forward`, `test_compile_disable_still_bypasses_the_block` fails.
Member
Author
|
@codex review The previous review has shown as running for 50 minutes. |
|
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.
Summary
tests/test_return_logits_survives_for_training.pyfails on main (8 of 9 tests) since #15137:The test pulls
FastBaseModel.for_inference/for_trainingout ofvision.pywithastand runs them in a namespace where unknown names resolve toNone. It only lifts a hand-kept list of_utils.pyhelpers. #15137 added the tensor parallel refusal at the top offor_inference(_refuse_tensor_parallel_for_inference, which calls_is_unsloth_tensor_parallel). Neither helper is on that list, so the call hitsNone. The product code is correct: the refusal is intended, and the real import invision.pyresolves fine. This shows up on any PR whoseRepo tests (CPU, rest)shard runs on current main, for example #15159.Change
_utils.pyfunction they name, transitively. Today that adds exactly the two tensor parallel helpers. The next helper either method gains gets lifted automatically instead of turning into the sameNoneTypeerror.test_lifted_for_inference_runs_its_real_helpers: a model carrying_unsloth_tpmust make the liftedfor_inferenceraise the real tensor parallelRuntimeError. This proves the harness runs the real guard, not a stand-in.Verification
8 failed, 1 passed. With this change:10 passed.for_training(os.environ.setdefault(...)back to a forced"0") fails 3 tests. The file still guards what it was written for.