Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed CheckpointManager to write the latest checkpoint to a consistent filename #2123

Merged
merged 2 commits into from
Jun 9, 2022

Conversation

tgaddair
Copy link
Collaborator

@tgaddair tgaddair commented Jun 9, 2022

This changes the checkpoint format from encoding the global step in the filename to having a single latest.ckpt file.

The previous approach required having a background process that would cleanup old checkpoints as training progressed. However, since we only retain the latest checkpoint, this added extra overhead for no benefit, and also caused synchronization issues when background processes would attempt to copy checkpoint files while they were being deleted by the training process.

In this implementation, the global step is instead put into the state dict along with model and optimizer weights. Additionally, checkpoints are first written to a temp directory to guarantee atomicity and prevent background processes from syncing tempfiles that will later be deleted.

Copy link
Contributor

@justinxzhao justinxzhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a nice simplification.

@github-actions
Copy link

github-actions bot commented Jun 9, 2022

Unit Test Results

       6 files  +       2         6 suites  +2   2h 21m 9s ⏱️ + 48m 25s
2 813 tests ±       0  2 781 ✔️ ±       0    32 💤 ±  0  0 ±0 
8 439 runs  +2 813  8 339 ✔️ +2 780  100 💤 +33  0 ±0 

Results for commit dc6ac83. ± Comparison against base commit dd026ca.

@tgaddair tgaddair merged commit 0918b0b into master Jun 9, 2022
@tgaddair tgaddair deleted the atomic-ckpt branch June 9, 2022 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants