[feat][checkpoint] Allow selective state restore on resume - #2010
[feat][checkpoint] Allow selective state restore on resume#2010bvolpato wants to merge 6 commits into
Conversation
08cf263 to
adffbdf
Compare
adffbdf to
a2b3558
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces four new configuration parameters (resume_load_global_step, resume_load_dataloader_state, resume_load_optimizer_states, and resume_load_lr_scheduler_states) to allow users to selectively disable restoring specific states when resuming from a checkpoint. The trainer logic and documentation have been updated accordingly, and new unit tests have been added. Feedback suggests explicitly checking if self.train_dataloader is initialized before attempting to restore its state to avoid potential AttributeError warnings when no dataloader exists.
9b0aeb4 to
93a835b
Compare
- Skip cursor restore cleanly when no train dataloader exists. - Gate fully async UID and epoch restore on resume configuration.
8e40852 to
b2cde16
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit b2cde16. Configure here.
Track whether the dataloader cursor restored successfully. When global step is kept without that cursor, run only the logical remainder of the first resumed epoch.

Summary
Allow checkpoint weights to seed a new training phase while independently controlling global-step, dataloader, optimizer, and learning-rate scheduler restoration.
Exact resume remains unchanged because every option defaults to
true.Changes
trainer.resume_load_global_step,trainer.resume_load_dataloader_state,trainer.resume_load_optimizer_states, andtrainer.resume_load_lr_scheduler_states.Testing
pytest tests/train/test_trainer.py tests/train/test_config.py tests/train/test_fully_async_trainer.py -q(179 passed)upstream/mainata6871df(183 passed)pre-commit run --all-filesuv lock --check66 pages)git diff --checkMegatron dependency
Merge #2149 before using
trainer.resume_load_optimizer_states=falsewith Megatron. It refreshes optimizer master parameters from the loaded model; without it, the first optimizer step can overwrite checkpoint weights with stale master values. Default full-state resume is unaffected.