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

Correct call to torch.no_grad #5124

Merged

Conversation

8greg8
Copy link
Contributor

@8greg8 8greg8 commented Dec 14, 2020

What does this PR do?

Fixes #5120

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together? Otherwise, we ask you to create a separate PR for every change.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

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:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified; Bugfixes should be including in bug-fix release milestones (m.f.X) and features should be included in (m.X.b) releases.

Did you have fun?

Make sure you had fun coding 🙃

@Borda Borda added the bug Something isn't working label Dec 14, 2020
@Borda Borda changed the title [bugfix] Correct call to torch.no_grad Correct call to torch.no_grad Dec 14, 2020
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.

good catch!

@@ -207,6 +207,6 @@ def all_gather_ddp_if_available(
if sync_grads:
return AllGatherGrad.apply(tensor, group)
else:
with torch.no_grad:
with torch.no_grad():
Copy link
Member

Choose a reason for hiding this comment

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

does it mean we have not ever called/tested this line? @tchaton

@Borda Borda added the priority: 1 Medium priority task label Dec 14, 2020
@codecov
Copy link

codecov bot commented Dec 14, 2020

Codecov Report

Merging #5124 (2444725) into master (5d2fa98) will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff           @@
##           master   #5124   +/-   ##
======================================
  Coverage      93%     93%           
======================================
  Files         134     134           
  Lines        9928    9928           
======================================
  Hits         9242    9242           
  Misses        686     686           

@awaelchli awaelchli added the distributed Generic distributed-related topic label Dec 16, 2020
@awaelchli awaelchli added this to the 1.1.x milestone Dec 16, 2020
@Borda Borda added the ready PRs ready to be merged label Dec 16, 2020
@Borda Borda merged commit 4c34855 into Lightning-AI:master Dec 19, 2020
Borda added a commit that referenced this pull request Dec 23, 2020
Co-authored-by: Gregor Koporec <gregork@unicorn.gorenje.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Borda added a commit that referenced this pull request Dec 29, 2020
Co-authored-by: Gregor Koporec <gregork@unicorn.gorenje.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Borda added a commit that referenced this pull request Jan 4, 2021
Co-authored-by: Gregor Koporec <gregork@unicorn.gorenje.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Borda added a commit that referenced this pull request Jan 4, 2021
Co-authored-by: Gregor Koporec <gregork@unicorn.gorenje.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Borda added a commit that referenced this pull request Jan 5, 2021
Co-authored-by: Gregor Koporec <gregork@unicorn.gorenje.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working distributed Generic distributed-related topic priority: 1 Medium priority task ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid usage of torch.no_grad Context manager
7 participants