3 b training prep#452
Merged
Merged
Conversation
… weights separately from the input embedding weights, since they will be tied together and should share the same initialization. The lm head weights will be initialized as part of the input embedding weights initialization, so we can remove the separate initialization for the lm head weights when weight tying is enabled.
rrutmann
approved these changes
Jun 19, 2026
| app_state=self, | ||
| state_dict=state_dict[StatefulComponents.OPTIMIZER.value], | ||
| ) | ||
| if self._lr_scheduler is not None and StatefulComponents.LR_SCHEDULER in self._components_to_load: |
Collaborator
There was a problem hiding this comment.
Should we raise an error if self._components_to_load contains something unexpected?
Member
Author
There was a problem hiding this comment.
added a check and also a test case for this.
| @@ -0,0 +1,137 @@ | |||
| from unittest.mock import MagicMock | |||
Collaborator
There was a problem hiding this comment.
Maybe add a test for invalid combinations of allow_partial_load and components_to_load
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.
What does this PR do?
This PR prepares the 3B training path by tightening weight-tying behavior for parallel training and by making DCP checkpoint restores more flexible.
General Changes
AppStatecomponent loading so checkpoint restore can load only the model, optimizer, and/or LR scheduler as needed.components_to_loadandallow_partial_loadthrough the app-state factory and DCP checkpoint loading path.has_tied_word_embeddingsmodel capability checks and centralize tied-embedding validation helpers.lm_headis only initialized separately when weight tying is disabled.has_tied_word_embeddingson GPT-2 models and add a default implementation on the base model class.Breaking Changes
allow_partial_load, which changes how partial checkpoint restores can be configured explicitly.Checklist before submitting final PR
python tests/tests.py)CHANGELOG_DEV.md)