Skip to content

change saving logic #2182

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

Merged
merged 2 commits into from
Dec 19, 2024
Merged

Conversation

felipemello1
Copy link
Contributor

@felipemello1 felipemello1 commented Dec 19, 2024

Context

What is the purpose of this PR? Is it to

  • add a new feature
  • x] fix a bug
  • update tests and/or documentation
  • other (please add here)

Changelog

  • Instead of saving model files to output_dir/base_model, we save them to output_dir/epoch_{}. That way, every epoch is ready for inference, without requiring an extra step. In the future, we can design this extra step better, e.g. 'tune prepare_for_inference args'
  • Have a file size limit of 100MiB. All expected files are configs + tokenizer, so they shouldn't be larger than that.

Test plan

tree -a /tmp/torchtune/llama3_2_3B/full_single_device
image

testing with HF
image

resuming from ckpt
image

Copy link

pytorch-bot bot commented Dec 19, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/2182

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 446e8cc with merge base cdf5ea2 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 19, 2024
@felipemello1 felipemello1 changed the title [wip] change saving logic change saving logic Dec 19, 2024
@@ -330,6 +329,7 @@ def copy_files(
output_dir: Union[str, Path],
*,
ignore_suffixes: Optional[List[str]] = None,
max_file_size_mb: int = 100,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there actually a way for someone to modify these values from the CLI/config? Seems like no, right?

Copy link
Contributor Author

@felipemello1 felipemello1 Dec 19, 2024

Choose a reason for hiding this comment

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

no, but i dont see it being an issue. It shouldnt happen, and If users really want to come a 100MB file to every epoch, they can do it manually.

Copy link
Contributor

@ebsmothers ebsmothers left a comment

Choose a reason for hiding this comment

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

Stamping to unblock. Please make sure to test that after the changes to the directory structure both resume from checkpoint and HF from_pretrained functionality are unaffected.

@felipemello1 felipemello1 merged commit c6ddf11 into pytorch:main Dec 19, 2024
14 checks passed
@felipemello1 felipemello1 deleted the base_model_in_epoch branch December 19, 2024 20:30
felipemello1 added a commit that referenced this pull request Dec 20, 2024
Co-authored-by: Felipe Mello <[email protected]>
mori360 pushed a commit to mori360/torchtune that referenced this pull request Dec 20, 2024
rahul-sarvam pushed a commit to sarvamai/torchtune that referenced this pull request Dec 23, 2024
rahul-sarvam pushed a commit to sarvamai/torchtune that referenced this pull request Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants