Add MpModelWrapper in TPU Spawn#7045
Merged
kaushikb11 merged 12 commits intomasterfrom Apr 20, 2021
Merged
Conversation
|
Hello @kaushikb11! Thanks for updating this PR. There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-04-20 12:04:48 UTC |
tchaton
approved these changes
Apr 15, 2021
carmocca
approved these changes
Apr 15, 2021
awaelchli
approved these changes
Apr 15, 2021
awaelchli
reviewed
Apr 15, 2021
Contributor
Author
|
Converted to Draft, as tpu tests were failing. |
tchaton
reviewed
Apr 19, 2021
|
|
||
| def training_step(self, *args, **kwargs): | ||
| return self.lightning_module.training_step(*args, **kwargs) | ||
| return self.model(*args, **kwargs) |
Contributor
There was a problem hiding this comment.
This should be wrapped_model.
Contributor
Author
There was a problem hiding this comment.
Assigning it while moving the model to device. https://github.com/PyTorchLightning/pytorch-lightning/blob/tpu_spawn_added/pytorch_lightning/plugins/training_type/tpu_spawn.py#L172
MpModelWrapper is just using mp lock and returns the model https://github.com/pytorch/xla/blob/master/torch_xla/distributed/xla_multiprocessing.py#L432
This file contains hidden or 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
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?
Add MpModelWrapper in TPU Spawn.
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃