-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Fix checkpointing to remote file paths #2925
Merged
williamFalcon
merged 1 commit into
Lightning-AI:master
from
f4hy:fix/checkpointing_remote_file_paths
Aug 12, 2020
Merged
Fix checkpointing to remote file paths #2925
williamFalcon
merged 1 commit into
Lightning-AI:master
from
f4hy:fix/checkpointing_remote_file_paths
Aug 12, 2020
Conversation
This file contains 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
Codecov Report
@@ Coverage Diff @@
## master #2925 +/- ##
=======================================
+ Coverage 86% 90% +4%
=======================================
Files 80 80
Lines 7449 7462 +13
=======================================
+ Hits 6430 6730 +300
+ Misses 1019 732 -287 |
Borda
approved these changes
Aug 12, 2020
Comment on lines
+273
to
+282
bytesbuffer = io.BytesIO() | ||
# Can't use the new zipfile serialization for 1.6.0 because there's a bug in | ||
# torch.hub.load_state_dict_from_url() that prevents it from loading the new files. | ||
# More details can be found here: https://github.com/pytorch/pytorch/issues/42239 | ||
if LooseVersion(torch.__version__).version[:3] == [1, 6, 0]: | ||
torch.save(checkpoint, tmp_path, _use_new_zipfile_serialization=False) | ||
torch.save(checkpoint, bytesbuffer, _use_new_zipfile_serialization=False) | ||
else: | ||
torch.save(checkpoint, tmp_path) | ||
os.replace(tmp_path, filepath) | ||
torch.save(checkpoint, bytesbuffer) | ||
with cloud_open(filepath, 'wb') as f: | ||
f.write(bytesbuffer.getvalue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we make this as a function too? when we have one-liner is_remote_path
ameliatqy
pushed a commit
to ameliatqy/pytorch-lightning
that referenced
this pull request
Aug 17, 2020
tarepan
added a commit
to tarepan/pytorch-lightning
that referenced
this pull request
Oct 29, 2020
Add fsspec's HTTPFileSystem support through http extras. pl has supported remote http file (e.g. Lightning-AI#2925), so this commit do not add new functionality.
tarepan
added a commit
to tarepan/pytorch-lightning
that referenced
this pull request
Oct 30, 2020
Add fsspec's HTTPFileSystem support through http extras. pl has supported remote http file (e.g. Lightning-AI#2925), so this commit do not add new functionality.
Borda
added a commit
that referenced
this pull request
Jan 5, 2021
…4402) * Add empty resume_from_checkpoint acceptance #4366 * Fix general error catch with focused file check * Add fsspec HTTP extras Add fsspec's HTTPFileSystem support through http extras. pl has supported remote http file (e.g. #2925), so this commit do not add new functionality. * Fix potential too much logging in DDP * Add PR changelog * Add well-written argument explanation Co-authored-by: Adrian Wälchli <[email protected]> * Fix DDP-compatible restore logging Notify from where the states are restored. This feature temporally deleted as a result of PR review. With succeeding review, added with DDP compatibility. * Fix utility import pathes * Refactor load step commentaries * Refactor hpc ckpt suffix acquisition * Refactor restore/hpc_load match * Refactor hpc load trial * Refactor checkpoint dir check * Refactor unneeded function nest * Refactor nested If * Refactor duplicated cache clear * Refactor attempt flow with if/elif * Fix pip8 * Refactor hook commentary Co-authored-by: chaton <[email protected]> * Fix pep8 * Refactor hpc load checkpoint path acquisition * Fix pip8 * Fix typo Co-authored-by: Adrian Wälchli <[email protected]> * Fix typo Co-authored-by: Adrian Wälchli <[email protected]> * Fix doc Co-authored-by: Adrian Wälchli <[email protected]> * Refactor None Union type with Optional * Fix build-doc CI failure debuged in #5329 * Fix fsspec import during build-doc #5329 * Fix test epoch Co-authored-by: Adrian Wälchli <[email protected]> * Fix test with latest test models * . Co-authored-by: Adrian Wälchli <[email protected]> Co-authored-by: chaton <[email protected]> Co-authored-by: Jirka Borovec <[email protected]> Co-authored-by: Sean Naren <[email protected]> Co-authored-by: Roger Shieh <[email protected]>
Borda
pushed a commit
that referenced
this pull request
Jan 6, 2021
…4402) * Add empty resume_from_checkpoint acceptance #4366 * Fix general error catch with focused file check * Add fsspec HTTP extras Add fsspec's HTTPFileSystem support through http extras. pl has supported remote http file (e.g. #2925), so this commit do not add new functionality. * Fix potential too much logging in DDP * Add PR changelog * Add well-written argument explanation Co-authored-by: Adrian Wälchli <[email protected]> * Fix DDP-compatible restore logging Notify from where the states are restored. This feature temporally deleted as a result of PR review. With succeeding review, added with DDP compatibility. * Fix utility import pathes * Refactor load step commentaries * Refactor hpc ckpt suffix acquisition * Refactor restore/hpc_load match * Refactor hpc load trial * Refactor checkpoint dir check * Refactor unneeded function nest * Refactor nested If * Refactor duplicated cache clear * Refactor attempt flow with if/elif * Fix pip8 * Refactor hook commentary Co-authored-by: chaton <[email protected]> * Fix pep8 * Refactor hpc load checkpoint path acquisition * Fix pip8 * Fix typo Co-authored-by: Adrian Wälchli <[email protected]> * Fix typo Co-authored-by: Adrian Wälchli <[email protected]> * Fix doc Co-authored-by: Adrian Wälchli <[email protected]> * Refactor None Union type with Optional * Fix build-doc CI failure debuged in #5329 * Fix fsspec import during build-doc #5329 * Fix test epoch Co-authored-by: Adrian Wälchli <[email protected]> * Fix test with latest test models * . Co-authored-by: Adrian Wälchli <[email protected]> Co-authored-by: chaton <[email protected]> Co-authored-by: Jirka Borovec <[email protected]> Co-authored-by: Sean Naren <[email protected]> Co-authored-by: Roger Shieh <[email protected]> (cherry picked from commit b0051e8)
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.
What does this PR do?
Fixes #2916
Better handling of file paths when checkpointing.
.part
file from being created. Which if remote could be slower.Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃