Repository navigation
Conversation
Signed-off-by: wiederse <1477618732@qq.com>
Contributor
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.
Superseded by #2891 (
freeze-mtp-skip-forward) after GPU validation.What does this PR do?
Type of change: Bug fix.
--freeze_mtppreviously froze the student's MTP-specific parameters and skipped its cross-entropy loss, but both teacher and student still executed the MTP transformer. The student's MTP activations could also be recomputed during backward through shared backbone tensors.Explicitly freezing MTP now bypasses its forward and loss paths for both models. The GPT wrapper temporarily disables both MTP gates using a shallow config copy, leaving the decoder's shared config intact for MoE auxiliary losses and activation recomputation. The original config and MTP flags are restored even if forward raises, and MTP parameters remain available in checkpoints and exports. The default behavior and the automatic freeze rule are unchanged.
Usage
Testing
git diff --check.test_skip_lm_loss_with_mtpto expect no MTP loss calls when explicitly frozen.test_freeze_mtp_with_quantized_mtpto cover dense and MoE models with full activation recomputation; forward hooks reject teacher/student MTP execution, while existing backward/optimizer assertions verify that the backbone trains and frozen MTP parameters remain unchanged. Additional assertions check checkpoint inclusion and config restoration after normal and exceptional forward.Before your PR is "Ready for review"
CONTRIBUTING.md: N/A.freeze_mtpin the same unreleased cycle.Additional Information
Related: #2784 changes the freeze override API; this PR retains the current API and addresses execution when
freeze_mtp=True.Summary by CodeRabbit
New Features
Documentation