feat: add checkpoint retention limit to automatically clean up old checkpoints#1798
Open
stevewx wants to merge 3 commits intoTHUDM:mainfrom
Open
feat: add checkpoint retention limit to automatically clean up old checkpoints#1798stevewx wants to merge 3 commits intoTHUDM:mainfrom
stevewx wants to merge 3 commits intoTHUDM:mainfrom
Conversation
3812101 to
66016b1
Compare
…eckpoints During long training runs, checkpoints can exhaust disk space. This adds support for keeping only the N most recent checkpoints on disk, deleting older ones automatically before each new save. Supports both Megatron and HF checkpoint formats, shared and local storage types.
66016b1 to
a08eb42
Compare
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
--max-actor-ckpt-to-keepand--max-critic-ckpt-to-keepto limit checkpoints kept on disk during long training runs--checkpoint-storage-type(shared/local) to control which rank performs cleanupkeep-1, so peak disk usage is exactly N checkpointsDesign
cleanup_old_checkpoints()inslime/utils/checkpoint_utils.pywith apath_fncallback to compose paths from rollout IDs_saved_rollout_ids) shared by both Megatron and HF cleanupshould_run_cleanup()pure function for rank selection logic, testable without distributed dependencies_maybe_cleanup_old_checkpoints()helper inactor.pyorchestrates cleanup:shared) or local rank 0 per node (local)save_hf_pretrainedalways writes from global rank 0)Test plan
--save-interval 1 --max-actor-ckpt-to-keep 2 --num-rollout 5on Qwen3.5-122B