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

[Docs] Note on running metric in dp #4494

Merged
merged 7 commits into from
Nov 9, 2020

Conversation

SkafteNicki
Copy link
Member

What does this PR do?

Fixes #4353
Metrics needs to be treated differently in DP mode (until we have statefull DP #1895). This PR adds a note to the docs what the user can do for now.

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

  • Is this pull request ready for review? (if not, please submit in draft mode)

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 🙃

@codecov
Copy link

codecov bot commented Nov 3, 2020

Codecov Report

Merging #4494 (9f2ed8f) into master (ee35907) will decrease coverage by 0%.
The diff coverage is n/a.

@@          Coverage Diff           @@
##           master   #4494   +/-   ##
======================================
- Coverage      93%     93%   -0%     
======================================
  Files         116     116           
  Lines        8833    8833           
======================================
- Hits         8235    8232    -3     
- Misses        598     601    +3     

Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

Great catch ! Any idea on how to solve ?

@SkafteNicki
Copy link
Member Author

@tchaton Only solution is to make a custom version of DataParallel (as PR #1895 tried to do) where we can insert hooks between these lines of code:
https://github.com/pytorch/pytorch/blob/73e121de1c69bba6863f38bea4b0044a920fdb20/torch/nn/parallel/data_parallel.py#L167-L168
such that metrics can accumulate their internal state after the data is send through the model, but before the results are gathered.

docs/source/metrics.rst Outdated Show resolved Hide resolved
@SkafteNicki SkafteNicki merged commit 01a925d into Lightning-AI:master Nov 9, 2020
@SkafteNicki SkafteNicki deleted the metrics/dp_note branch November 9, 2020 10:30
SeanNaren pushed a commit that referenced this pull request Nov 10, 2020
* note

* Update docs/source/metrics.rst

Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Co-authored-by: Jeff Yang <ydcjeff@outlook.com>
(cherry picked from commit 01a925d)
SeanNaren pushed a commit that referenced this pull request Nov 11, 2020
* note

* Update docs/source/metrics.rst

Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Co-authored-by: Jeff Yang <ydcjeff@outlook.com>
(cherry picked from commit 01a925d)
Borda pushed a commit that referenced this pull request Nov 11, 2020
* note

* Update docs/source/metrics.rst

Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Co-authored-by: Jeff Yang <ydcjeff@outlook.com>
(cherry picked from commit 01a925d)
rohitgr7 pushed a commit that referenced this pull request Nov 21, 2020
* note

* Update docs/source/metrics.rst

Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Co-authored-by: Jeff Yang <ydcjeff@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation related strategy: dp (removed in pl) DataParallel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metrics fail on DP and multiple GPU
5 participants