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

Fix setup callback hook to pass LightningModule through #4608

Merged
merged 7 commits into from
Nov 14, 2020

Conversation

ananthsub
Copy link
Contributor

@ananthsub ananthsub commented Nov 10, 2020

What does this PR do?

As currently written, the setup() function in callbacks is passed model=None since Trainer.model is not yet set when the call to self.trainer.get_model() is made. This PR explicitly passes model through to the callback instead of relying on self.trainer.get_model()

cc @kandluis

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 🙃

@codecov
Copy link

codecov bot commented Nov 10, 2020

Codecov Report

Merging #4608 (15783f8) into master (2d78d9b) will decrease coverage by 0%.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master   #4608    +/-   ##
=======================================
- Coverage      93%     93%    -0%     
=======================================
  Files         117     117            
  Lines        8805    8914   +109     
=======================================
+ Hits         8172    8273   +101     
- Misses        633     641     +8     

@ananthsub ananthsub changed the title Fix setup callback hook Fix setup callback hook to pass LightningModule through Nov 10, 2020
@ananthsub
Copy link
Contributor Author

cc @awaelchli @SeanNaren @tchaton

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 !

@Borda Borda added the bug Something isn't working label Nov 13, 2020
@Borda Borda modified the milestone: 1.0.x Nov 13, 2020
@Borda Borda added the design Includes a design discussion label Nov 13, 2020
@SeanNaren SeanNaren added this to the 1.0.x milestone Nov 13, 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.

LGTM, just it seems to be API change for setup hook

@Borda Borda added the ready PRs ready to be merged label Nov 13, 2020
@Borda
Copy link
Member

Borda commented Nov 13, 2020

@williamFalcon could you pls approve this API/hook change as part of bugfix release?

@williamFalcon williamFalcon merged commit d096a2e into Lightning-AI:master Nov 14, 2020
tchaton pushed a commit that referenced this pull request Nov 17, 2020
* Fix setup callback hook

* Update CHANGELOG.md

* Update test_trainer.py

* Update test_trainer.py

* Update test_trainer.py

* fix chlog

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
rohitgr7 pushed a commit that referenced this pull request Nov 21, 2020
* Fix setup callback hook

* Update CHANGELOG.md

* Update test_trainer.py

* Update test_trainer.py

* Update test_trainer.py

* fix chlog

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.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 design Includes a design discussion ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants