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

Makes automatic optimization a model attribute #4602

Merged
merged 15 commits into from
Nov 14, 2020
Merged

Conversation

justusschock
Copy link
Member

@justusschock justusschock commented Nov 10, 2020

What does this PR do?

Makes automatic optimisation a model property and deprecates the trainer flag. Fixes #4317

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 in short, see 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 🙃

cc @ananthsub

@pep8speaks
Copy link

pep8speaks commented Nov 10, 2020

Hello @justusschock! Thanks for updating this PR.

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

Comment last updated at 2020-11-14 04:04:19 UTC

@codecov
Copy link

codecov bot commented Nov 10, 2020

Codecov Report

Merging #4602 (27bdd7a) into master (144a5c9) will increase coverage by 0%.
The diff coverage is 100%.

@@          Coverage Diff           @@
##           master   #4602   +/-   ##
======================================
  Coverage      93%     93%           
======================================
  Files         117     117           
  Lines        8914    8921    +7     
======================================
+ Hits         8280    8287    +7     
  Misses        634     634           

@SeanNaren
Copy link
Contributor

@justusschock able to fix the failing codefactor test?

@ydcjeff ydcjeff added this to the 1.1 milestone Nov 10, 2020
Copy link
Contributor

@rohitgr7 rohitgr7 left a comment

Choose a reason for hiding this comment

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

Just some comments. Else LGTM.

pytorch_lightning/core/lightning.py Outdated Show resolved Hide resolved
pytorch_lightning/trainer/trainer.py Outdated Show resolved Hide resolved
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 added the ready PRs ready to be merged label Nov 13, 2020
@ydcjeff ydcjeff merged commit e04e7c9 into master Nov 14, 2020
@ydcjeff ydcjeff deleted the automatic_optimization branch November 14, 2020 04:43
rohitgr7 added a commit that referenced this pull request Nov 21, 2020
* Makes automatic optimization a model attribute

* Update trainer.py

* remove setting property in model

* Update pytorch_lightning/core/lightning.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update pytorch_lightning/trainer/trainer.py

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Update trainer.py

Co-authored-by: Sean Naren <sean.narenthiran@gmail.com>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Jeff Yang <ydcjeff@outlook.com>
@ananthsub
Copy link
Contributor

ananthsub commented Dec 17, 2020

@justusschock what do you think about a corresponding setter decorator to easily change this on the module? #5169

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is an improvement or enhancement ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatic Optimization should be a property of the LightningModule, not the Trainer
9 participants