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

Refactor LightningDataParallel #5670

Merged
merged 44 commits into from
Jan 31, 2021
Merged

Refactor LightningDataParallel #5670

merged 44 commits into from
Jan 31, 2021

Conversation

awaelchli
Copy link
Contributor

@awaelchli awaelchli commented Jan 27, 2021

What does this PR do?

Fixes #5506
Follow-up to #5185

It is a bit hard to see what happens in the diff, because there are a lot of deletions.
I recommend to view diff in split view: Go to Files changed tab -> settings wheel -> change unifided to split

The refactor for DP here is basically analogeous to the refactor I did in #5185, with the addition that in DP we need to 1) convert Python scalars to tensors (to match functionality we had before) and 2) automatically unsqueeze 0-dim tensors

Todo: write tests

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
  • Check that target branch and milestone match!

Did you have fun?

Make sure you had fun coding 🙃

@awaelchli awaelchli added this to the 1.2 milestone Jan 27, 2021
@codecov
Copy link

codecov bot commented Jan 27, 2021

Codecov Report

Merging #5670 (6a22d1d) into release/1.2-dev (5d239cc) will decrease coverage by 0%.
The diff coverage is 97%.

@@               Coverage Diff               @@
##           release/1.2-dev   #5670   +/-   ##
===============================================
- Coverage               89%     89%   -0%     
===============================================
  Files                  169     173    +4     
  Lines                12415   12339   -76     
===============================================
- Hits                 11099   11015   -84     
- Misses                1316    1324    +8     

@pep8speaks
Copy link

pep8speaks commented Jan 27, 2021

Hello @awaelchli! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-01-31 07:19:40 UTC

@awaelchli awaelchli force-pushed the refactor/lightning-dp branch from 2b0b465 to 795f9f0 Compare January 27, 2021 04:02
pytorch_lightning/overrides/data_parallel.py Outdated Show resolved Hide resolved
pytorch_lightning/overrides/data_parallel.py Outdated Show resolved Hide resolved
pytorch_lightning/overrides/data_parallel.py Outdated Show resolved Hide resolved
pytorch_lightning/overrides/data_parallel.py Outdated Show resolved Hide resolved
@awaelchli awaelchli changed the title Refactor LightningDataParallel Refactor LightningDataParallel [skip ci] Jan 29, 2021
Copy link
Contributor

@ananthsub ananthsub left a comment

Choose a reason for hiding this comment

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

LGTM!

@Borda Borda changed the title Refactor LightningDataParallel [skip ci] Refactor LightningDataParallel Jan 29, 2021
pytorch_lightning/overrides/base.py Show resolved Hide resolved
pytorch_lightning/overrides/data_parallel.py Show resolved Hide resolved
tests/deprecated_api/test_remove_1-4.py Outdated Show resolved Hide resolved
@Borda Borda added ready PRs ready to be merged strategy: dp (removed in pl) DataParallel labels Jan 29, 2021
@awaelchli
Copy link
Contributor Author

Thanks for the reviews.
@Borda Unfortunately, there is an existing DP test failing which I haven't been able to figure out yet, so the PR is not yet ready to merge. So I am removing the ready label for now

@awaelchli awaelchli removed the ready PRs ready to be merged label Jan 29, 2021
@Borda Borda added ready PRs ready to be merged and removed ready PRs ready to be merged labels Jan 29, 2021
@awaelchli awaelchli force-pushed the refactor/lightning-dp branch from e3175b1 to c66ae77 Compare January 31, 2021 06:21
@mergify mergify bot removed the has conflicts label Jan 31, 2021
@awaelchli awaelchli force-pushed the refactor/lightning-dp branch from dc1350e to 38f837b Compare January 31, 2021 07:00
@awaelchli awaelchli added the ready PRs ready to be merged label Jan 31, 2021
@awaelchli
Copy link
Contributor Author

@Borda Tests passing now, and I fixed the cyclic import error. This should be good now :)

@Borda Borda enabled auto-merge (squash) January 31, 2021 08:54
@Borda Borda merged commit 692f77b into release/1.2-dev Jan 31, 2021
@Borda Borda deleted the refactor/lightning-dp branch January 31, 2021 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready PRs ready to be merged refactor strategy: dp (removed in pl) DataParallel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants