fix(megatron): defer full-vocabulary GKD teacher logits to forward_step - #10276
Open
FOWEPJF255 wants to merge 2 commits into
Open
FOWEPJF255 wants to merge 2 commits into
FOWEPJF255 wants to merge 2 commits into
Conversation
When gkd_logits_topk is unset, materialize local teacher [S, V] logits just-in-time per micro-batch instead of retaining one tensor per rollout batch during preparation. Top-k teacher outputs stay eager. Fixes modelscope#10097. Co-authored-by: Cursor <cursoragent@cursor.com>
Author
|
CI note: fork PR workflows show action_required (citest / Lint test / citest-npu). This is the upstream approval gate for first-time fork contributors -- not a code failure. Please approve workflow runs when convenient so checks can execute. Local: |
Co-authored-by: Cursor <cursoragent@cursor.com>
Author
|
Pushed \dd247d4: fix isort blank line in \ ests/megatron/test_gkd_teacher_logits_defer.py\ (Lint test failed on isort auto-fix). Local isort check + pytest for that file pass. Fork workflows may still show \�ction_required\ until upstream approves. |
This branch has not been deployed
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
gkd_logits_topkis unset, defer local teacher full-vocabulary logits toforward_stepso only one[S, V]tensor is alive per micro-batch instead of one per rollout batch during preparation._compute_teacher_output_localfor single-micro-batch teacher forwards; keep top-k teacher outputs eager at batch prep (small tensors).forward_step.Fixes #10097
Test plan
python -m pytest tests/megatron/test_gkd_teacher_logits_defer.py -q(3 passed locally; skips when megatron-core/transformers are unavailable)Made with Cursor