Add fine-grained checkpoint saving controls#2854
Add fine-grained checkpoint saving controls#2854DonggyuBan wants to merge 6 commits intometa-pytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/2854
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Hi @DonggyuBan! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Context
What is the purpose of this PR? Is it to
This PR introduces two new features to control checkpoint saving behavior in the LoRA recipe:
epochs_to_save: A new argument that allows users to specify exactly which epochs to save. It can be set to 'all', 'none', or a comma-separated list of epoch numbers (e.g., '1,5,10').
save_last_epoch_only: This existing flag is now an override. If set to True, it will save only the final epoch, regardless of the epochs_to_save setting.
These features give users more control over disk space usage by allowing them to save only the checkpoints they need.
Changelog
What are the changes made in this PR?
Feature Implementation:
epochs_to_saveto the LoRA fine-tuning recipe, allowing users to save all, none, or a specific list of epoch checkpoints (e.g., '1,5,10').save_last_epoch_onlyto act as an override, saving only the final epoch checkpoint regardless of other settings.Test Coverage:
test_save_last_epoch_onlyintegration test for regular checkpointing modetest_save_last_epoch_only_with_async_checkpointingintegration test for async checkpointing modeTest plan
Please make sure to do each of the following if applicable to your PR. If you're unsure about any one of these just ask and we will happily help. We also have a contributing page for some guidance on contributing.
pre-commit install)pytest testspytest tests -m integration_testUX
If your function changed a public API, please add a dummy example of what the user experience will look like when calling it.
Here is a docstring example
and a tutorial example