-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Only call into reducer if torch.is_grad_enabled() #19897
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
Closed
Closed
Conversation
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
Differential Revision: D15118726 Differential Version: 80866244
Differential Revision: D15118726 Differential Version: 80866256
mrshenli
approved these changes
Apr 29, 2019
soumith
suggested changes
Apr 29, 2019
Differential Revision: D15118726 Differential Version: 80866864
soumith
approved these changes
Apr 29, 2019
Contributor
|
This pull request has been merged in 5525c41. |
soumith
pushed a commit
that referenced
this pull request
Apr 29, 2019
Summary: Pull Request resolved: #19897 During validation, gradient reduction is not needed, and autograd is never called. The model output will always be a detached tensor. After the new reducer was merged, this meant that it would find all model parameters unused, and kick off reduction for them. When #19799 and output where no parameters are used and it tries to kick off reduction of zeroed gradients. Test for `torch.is_grad_enabled()` and `self.training` before calling into the reducer. Reviewed By: mrshenli Differential Revision: D15118726 fbshipit-source-id: b0208f632a61cbe8110fa626fa427937b7f05924
zhangguanheng66
pushed a commit
to zhangguanheng66/pytorch
that referenced
this pull request
May 6, 2019
Summary: Pull Request resolved: pytorch#19897 During validation, gradient reduction is not needed, and autograd is never called. The model output will always be a detached tensor. After the new reducer was merged, this meant that it would find all model parameters unused, and kick off reduction for them. When pytorch#19799 and output where no parameters are used and it tries to kick off reduction of zeroed gradients. Test for `torch.is_grad_enabled()` and `self.training` before calling into the reducer. Reviewed By: mrshenli Differential Revision: D15118726 fbshipit-source-id: b0208f632a61cbe8110fa626fa427937b7f05924
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
module: nn
Related to torch.nn
oncall: distributed
Add this issue/PR to distributed oncall triage queue
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.
Stack:
:black_circle: #19901 Finer grained consistency check in reducer 💛
:white_circle: #19897 Only call into reducer if torch.is_grad_enabled() 💚
During validation, gradient reduction is not needed, and autograd is
never called. The model output will always be a detached tensor. After
the new reducer was merged, this meant that it would find all model
parameters unused, and kick off reduction for them. When #19799 and
#19821 were merged it looked like model output during validation is an
output where no parameters are used and it tries to kick off reduction
of zeroed gradients. Test for
torch.is_grad_enabled()andself.trainingbefore calling into the reducer.Differential Revision: D15118726