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

Added getstate/setstate method for torch.save serialization #4127

Merged
merged 6 commits into from Oct 13, 2020
Merged

Conversation

SeanNaren
Copy link
Contributor

@SeanNaren SeanNaren commented Oct 13, 2020

What does this PR do?

Fixes #4114 and Fixes #4120

Still requires test, and to see if there is a less verbose way to fix serialization in the accelerator class.

Also note that this will omit any additional state variables of accelerators that inherit from this; it assumes custom accelerator will override __getstate__ and __setstate__, or ensure that other objects are setup again.

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 🙃

@mergify mergify bot requested a review from a team October 13, 2020 16:24
@codecov
Copy link

codecov bot commented Oct 13, 2020

Codecov Report

Merging #4127 into master will increase coverage by 3%.
The diff coverage is 58%.

@@           Coverage Diff           @@
##           master   #4127    +/-   ##
=======================================
+ Coverage      89%     92%    +3%     
=======================================
  Files         103     103            
  Lines        7781    7792    +11     
=======================================
+ Hits         6919    7147   +228     
+ Misses        862     645   -217     

@SeanNaren SeanNaren changed the title [WIP] Added getstate/setstate method for torch.save serialization Added getstate/setstate method for torch.save serialization Oct 13, 2020
@pep8speaks
Copy link

pep8speaks commented Oct 13, 2020

Hello @SeanNaren! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-10-13 20:22:57 UTC

@Borda Borda added the feature Is an improvement or enhancement label Oct 13, 2020
tests/checkpointing/test_model_checkpoint.py Outdated Show resolved Hide resolved
tests/checkpointing/test_model_checkpoint.py Outdated Show resolved Hide resolved
tests/checkpointing/test_model_checkpoint.py Outdated Show resolved Hide resolved
Copy link
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

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

LGTM, just minor srestructure :]

tests/checkpointing/test_model_checkpoint.py Outdated Show resolved Hide resolved
@mergify mergify bot requested a review from a team October 13, 2020 18:57
Copy link
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

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

seems like some tests are hanging

@mergify mergify bot requested a review from a team October 13, 2020 19:02


@pytest.mark.skipif(torch.cuda.device_count() < 2, reason="test requires multi-GPU machine")
def test_model_torch_save_ddp_cuda(tmpdir):
Copy link
Member

Choose a reason for hiding this comment

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

seems like this guy is hanging...

@mergify mergify bot requested a review from a team October 13, 2020 19:05
@mergify mergify bot requested a review from a team October 13, 2020 20:22
@williamFalcon williamFalcon merged commit 98eb736 into master Oct 13, 2020
@SeanNaren SeanNaren deleted the 4114 branch October 13, 2020 20:47
@Borda Borda added this to the 1.0.x milestone Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is an improvement or enhancement
Projects
None yet
6 participants