Add checkpointing support for Tinker SkyRL backend#990
Closed
tyler-griggs wants to merge 2 commits intotyler/tinker-sft-integrationfrom
Closed
Add checkpointing support for Tinker SkyRL backend#990tyler-griggs wants to merge 2 commits intotyler/tinker-sft-integrationfrom
tyler-griggs wants to merge 2 commits intotyler/tinker-sft-integrationfrom
Conversation
Add support for saving and loading training checkpoints, enabling sl_loop.py to run unchanged with full checkpoint/resume functionality. Key changes: - save_checkpoint(): Saves full training state (model + optimizer + scheduler) as tar.gz archive - load_checkpoint(): Loads training state from tar.gz and restores optimizer and scheduler states for seamless resume - save_sampler_checkpoint(): Exports HuggingFace format for inference/sampling (model only, no optimizer) Implementation leverages existing WorkerDispatch checkpoint methods: - Uses FSDP's distributed checkpoint format (per-rank sharded files) - Automatically includes LoRA adapter state - Preserves RNG state for reproducibility This enables: - Periodic checkpoint saves during training - Resume training from last checkpoint - Optimizer state preservation (no loss spikes on resume) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Checkpoints are already large (6-7GB with FSDP sharding), and gzip compression adds 5-10 minutes of single-threaded CPU time that blocks training. Uncompressed tar is much faster. Future optimization: move checkpoint saving to async background thread. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Member
Author
|
Closing this PR - replaced by new PR based on origin/main instead of tyler/tinker-sft-integration |
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
Implements checkpointing for the Tinker SkyRL backend, enabling
sl_loop.pyto run unchanged with full checkpoint save/load/resume functionality.Builds on PR #986 (Tinker API server integration)
Changes
1. Checkpoint Implementation (
skyrl_train/tinker/backends/skyrl_train.py)Implemented 3 checkpoint methods (~70 lines):
save_checkpoint(output_path, model_id)WorkerDispatch.save_checkpoint()which handles FSDP distributed checkpointingmodel_world_size_4_rank_*.pt)load_checkpoint(checkpoint_path, model_id)save_sampler_checkpoint(output_path, model_id)WorkerDispatch.save_hf_model()for clean model export2. Performance Optimization
Uncompressed tar instead of gzip (commit 181518b):
3. Bug Fixes
Parent directory creation (commit 29dd0ad):
os.makedirs(os.path.dirname(output_path), exist_ok=True)Architecture
Expected Usage
With this PR,
sl_loop.pycan run unchanged with checkpointing:Checkpointing behavior:
save_every)checkpoints.jsonlTesting Status
What's verified:
What needs testing (once Ray issues resolved):
Files Changed
skyrl_train/tinker/backends/skyrl_train.py- Implemented 3 checkpoint methods (~80 lines)Next Steps
sl_loop.pyPerformance Notes
Checkpoint save time (estimated):
Future optimization: Move checkpoint saving to background thread to avoid blocking training loop.
🤖 Generated with Claude Code