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

[DCP] overwrites existing checkpoint by default #125877

Closed
wants to merge 4 commits into from

Conversation

LucasLLC
Copy link
Contributor

@LucasLLC LucasLLC commented May 9, 2024

Checks for existing checkpoints and overwrites, based on an `overwrite` flag

Differential Revision: [D57186174](https://our.internmc.facebook.com/intern/diff/D57186174/)

[ghstack-poisoned]
Copy link

pytorch-bot bot commented May 9, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit 94cd15b with merge base 96bdb7a (image):
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot pytorch-bot bot added module: distributed_checkpoint oncall: distributed Add this issue/PR to distributed oncall triage queue labels May 9, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57186174

LucasLLC added a commit that referenced this pull request May 9, 2024
Checks for existing checkpoints and overwrites, based on an `overwrite` flag

Differential Revision: [D57186174](https://our.internmc.facebook.com/intern/diff/D57186174/)

ghstack-source-id: 225828668
Pull Request resolved: #125877
@LucasLLC LucasLLC requested review from fegin and wz337 May 9, 2024 22:47
@LucasLLC LucasLLC self-assigned this May 9, 2024
@LucasLLC LucasLLC requested review from wz337 and removed request for wz337 May 9, 2024 22:47
self.assertTrue(torch.allclose(sd["random"], t2))

dcp.save(
{"random": t2}, storage_writer=FsspecWriter(self.temp_dir, overwrite=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be overwrite=False when exception is raised, As the default is overwrite=True.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, and the format for assert raises is wrong as well, I'll have to take a look

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, thanks @wz337 !

Checks for existing checkpoints and overwrites, based on an `overwrite` flag

Differential Revision: [D57186174](https://our.internmc.facebook.com/intern/diff/D57186174/)

cc mrshenli pritamdamania87 zhaojuanmao satgera gqchen aazzolini osalpekar jiayisuse H-Huang kwen2501 awgu penguinwu fegin XilunWu wanchaol fduwjj wz337 tianyu-l wconstab yf225 chauhang d4l3k

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57186174

LucasLLC added a commit that referenced this pull request May 9, 2024
Pull Request resolved: #125877

Checks for existing checkpoints and overwrites, based on an `overwrite` flag
ghstack-source-id: 225839692
@exported-using-ghexport

Differential Revision: [D57186174](https://our.internmc.facebook.com/intern/diff/D57186174/)
@LucasLLC LucasLLC requested a review from wz337 May 9, 2024 23:48
Copy link
Contributor

@fegin fegin left a comment

Choose a reason for hiding this comment

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

It's good to have the overwritten feature. But shouldn't this be an opt-in feature? Just like the cp linux command will explicitly ask if users would want to overwrite the existing checkpointing. If we do this implicitly, would it cause some surprises to the users?

@LucasLLC
Copy link
Contributor Author

It's good to have the overwritten feature. But shouldn't this be an opt-in feature? Just like the cp linux command will explicitly ask if users would want to overwrite the existing checkpointing. If we do this implicitly, would it cause some surprises to the users?

good point, will update

Checks for existing checkpoints and overwrites, based on an `overwrite` flag

Differential Revision: [D57186174](https://our.internmc.facebook.com/intern/diff/D57186174/)

cc mrshenli pritamdamania87 zhaojuanmao satgera gqchen aazzolini osalpekar jiayisuse H-Huang kwen2501 awgu penguinwu fegin XilunWu wanchaol fduwjj wz337 tianyu-l wconstab yf225 chauhang d4l3k

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57186174

LucasLLC added a commit that referenced this pull request May 14, 2024
Pull Request resolved: #125877

Checks for existing checkpoints and overwrites, based on an `overwrite` flag
ghstack-source-id: 226331209
@exported-using-ghexport

Differential Revision: [D57186174](https://our.internmc.facebook.com/intern/diff/D57186174/)
@LucasLLC LucasLLC added the topic: not user facing topic category label May 14, 2024
@LucasLLC LucasLLC requested a review from fegin May 14, 2024 19:42
@LucasLLC
Copy link
Contributor Author

Will fix errors before merging

Checks for existing checkpoints and overwrites, based on an `overwrite` flag

Differential Revision: [D57186174](https://our.internmc.facebook.com/intern/diff/D57186174/)

cc mrshenli pritamdamania87 zhaojuanmao satgera gqchen aazzolini osalpekar jiayisuse H-Huang kwen2501 awgu penguinwu fegin XilunWu wanchaol fduwjj wz337 tianyu-l wconstab yf225 chauhang d4l3k

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57186174

LucasLLC added a commit that referenced this pull request May 15, 2024
Pull Request resolved: #125877

Checks for existing checkpoints and overwrites, based on an `overwrite` flag
ghstack-source-id: 226452355
@exported-using-ghexport

Differential Revision: [D57186174](https://our.internmc.facebook.com/intern/diff/D57186174/)
@LucasLLC
Copy link
Contributor Author

Will fix errors before merging

It's good to have the overwritten feature. But shouldn't this be an opt-in feature? Just like the cp linux command will explicitly ask if users would want to overwrite the existing checkpointing. If we do this implicitly, would it cause some surprises to the users?

good point, will update

We decided actually that setting overwrite=True as the default is safer due to BC considerations, since it turns out depending on the implementation (fsspec vs. filesystem), overwrite may or may not error when attempting to overwrite, but in the case of this PR will always raise if overwrite=False

I added a warning when we detect a checkpoint, and will change overwrite=False as the default after 2.5

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label May 15, 2024
@LucasLLC
Copy link
Contributor Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

ZelboK pushed a commit to ZelboK/pytorch that referenced this pull request May 19, 2024
Checks for existing checkpoints and overwrites, based on an `overwrite` flag

Differential Revision: [D57186174](https://our.internmc.facebook.com/intern/diff/D57186174/)

Pull Request resolved: pytorch#125877
Approved by: https://github.com/fegin
@github-actions github-actions bot deleted the gh/lucasllc/31/head branch June 15, 2024 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request fb-exported Merged module: distributed_checkpoint oncall: distributed Add this issue/PR to distributed oncall triage queue topic: not user facing topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants