[WIP][bugfix] restore LR scheduler progress on resume - #664
Draft
WhiteSwan1 wants to merge 1 commit into
Draft
WhiteSwan1 wants to merge 1 commit into
WhiteSwan1 wants to merge 1 commit into
Conversation
Checkpoints omitted LR scheduler state, so resumed training restarted the schedule even when optimizer state was restored. Save per-rank scheduler state and restore it with an opt-in CLI flag, reconstruct legacy progress when needed, and persist epoch advancement before checkpointing.
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
Training checkpoints currently restore model and optimizer state but do not save LR scheduler progress, so resumed training restarts the learning rate schedule.
Add an opt-in
--restore_lr_schedulerCLI flag, defaulting to false to preserve existing behavior. It works independently of--ignore_restore_optimizer. Checkpoints save per-rank scheduler state, and restoration also updates optimizer learning rates before the first resumed batch. Epoch-based schedules advance before the epoch checkpoint is saved.For legacy checkpoints without scheduler state, reconstruct progress from the saved batch index or completed epoch count using the unchanged LR configuration. Report an error when the required progress is unavailable. Training with no existing checkpoint still starts normally.
The restore policy is a CLI option rather than a TrainConfig field: it is a launch-time decision, keeps existing configurations unchanged, and needs no protobuf change. Saved-state restoration requires the same world size, scheduler types/order, and local parameter-group counts.
Test Plan
pre-commit run -a: all hooks passed.pyrefly check: 0 errors.