Repository navigation
Tests: ignore torch.compile resume functions when counting MLP-skip arming layers - #18688
Merged
Merged
Conversation
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. |
Member
Author
|
@codex review |
|
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". |
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
Repo tests (CPU, rest)fails intermittently on currentmain. It is seen on #18650 and #18532, both based on recentmain, and both runs include #18607 and #18641:Cause
#18607 added this test. It collects every module-level function in
unsloth.models.{llama, gemma, ...}whose source callsarm_mlp_output_unread(and expects exactlyLlamaDecoderLayer_fast_forward.When an earlier test in the same xdist worker compiles that layer and hits a graph break, Dynamo parks the continuation function (
__resume_at_<offset>_<n>) in the compiled function's module globals. That puts it inunsloth.models.llama. Its code object points atLlamaDecoderLayer_fast_forward's lines, soinspect.getsourcereturns the same source, and it counts as a second arming layer. The test passes alone and fails only when such a compile ran first in the worker. The product code is right; the test's view of the module namespace was not.Change
tests/test_gc_skip_replay_mlp_down.py: only count a function when its code name matches the name it is bound under (fn.__code__.co_name == fn_name). Dynamo's resume functions are bound as__resume_at_*but namedtorch_dynamo_resume_in_*, so they drop out. Every function defined in the module withdefstill matches.Testing
tests/test_gc_skip_replay_mlp_down.py: 18 passed, 6 skipped (the six need CUDA).co_name = "torch_dynamo_resume_in_LlamaDecoderLayer_fast_forward_at_514", bound as__resume_at_514_178inunsloth.models.llama. The test frommainfails withLeft contains one more item: '__resume_at_514_178'; this version passes.unsloth.models.gemmastill fails it (Left contains one more item: 'GemmaDecoderLayer_arming').