Skip to content

Conversation

@SeanNaren
Copy link
Contributor

@SeanNaren SeanNaren commented Mar 3, 2021

What does this PR do?

Fixes #6322

It seems somewhere along the line we lost the guard to ensure we only clip gradients when greater than 0. Add a test to make sure we don't do so in the future.
cc @mees

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • 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?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

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

Did you have fun?

Make sure you had fun coding 🙃

@codecov
Copy link

codecov bot commented Mar 3, 2021

Codecov Report

Merging #6330 (ae6d79a) into master (b9cf122) will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff           @@
##           master   #6330   +/-   ##
======================================
  Coverage      93%     93%           
======================================
  Files         160     160           
  Lines       11304   11304           
======================================
  Hits        10531   10531           
  Misses        773     773           

Comment on lines 285 to 288
if clip_val > 0:
mock_oss_clip_grad_norm.assert_called()
else:
mock_oss_clip_grad_norm.assert_not_called()
Copy link
Contributor

Choose a reason for hiding this comment

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

nice usage of mock! love it

@SeanNaren SeanNaren added ready PRs ready to be merged bug Something isn't working distributed Generic distributed-related topic 3rd party Related to a 3rd-party labels Mar 4, 2021
@SeanNaren SeanNaren added this to the 1.2.x milestone Mar 4, 2021
@SeanNaren SeanNaren enabled auto-merge (squash) March 4, 2021 19:24
@SeanNaren SeanNaren merged commit 39231ae into master Mar 4, 2021
@SeanNaren SeanNaren deleted the fix/sharded_clip_val branch March 4, 2021 19:46
@tchaton tchaton mentioned this pull request Mar 8, 2021
tchaton pushed a commit that referenced this pull request Mar 9, 2021
* Call clip gradients if clip val greater than 0

* format

* Format

* Move to top of file
Borda pushed a commit that referenced this pull request Mar 9, 2021
* Call clip gradients if clip val greater than 0

* format

* Format

* Move to top of file
tchaton pushed a commit that referenced this pull request Mar 9, 2021
* Call clip gradients if clip val greater than 0

* format

* Format

* Move to top of file
tchaton pushed a commit that referenced this pull request Mar 9, 2021
* Call clip gradients if clip val greater than 0

* format

* Format

* Move to top of file
lexierule pushed a commit that referenced this pull request Mar 9, 2021
* Call clip gradients if clip val greater than 0

* format

* Format

* Move to top of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3rd party Related to a 3rd-party bug Something isn't working distributed Generic distributed-related topic ready PRs ready to be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DDP + mixed precision + sharded not working on PL 1.2.1

4 participants