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 invalid value for weights_summary #5296

Merged
merged 7 commits into from
Jan 5, 2021
Merged

Fix invalid value for weights_summary #5296

merged 7 commits into from
Jan 5, 2021

Conversation

rohitgr7
Copy link
Contributor

What does this PR do?

The main fix here is if you do model.summarize(None) it still prints the total params, trainable params, ... and if you do model.summarize('invalid_string or value') it won't raise an error and will act like None.

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?
  • Did you make sure to update the documentation with your changes [if needed]?
  • Did you write any new necessary tests [no need for typos, docs]?
  • 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 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 are aligned!

Did you have fun?

Make sure you had fun coding 🙃

@rohitgr7 rohitgr7 added the bug Something isn't working label Dec 29, 2020
@rohitgr7 rohitgr7 added this to the 1.1.x milestone Dec 29, 2020
@codecov
Copy link

codecov bot commented Dec 29, 2020

Codecov Report

Merging #5296 (03f8684) into master (15a400b) will increase coverage by 0%.
The diff coverage is 100%.

@@          Coverage Diff           @@
##           master   #5296   +/-   ##
======================================
  Coverage      93%     93%           
======================================
  Files         134     134           
  Lines        9950    9954    +4     
======================================
+ Hits         9261    9266    +5     
+ Misses        689     688    -1     

@rohitgr7 rohitgr7 marked this pull request as ready for review December 30, 2020 11:49
@Borda Borda modified the milestones: 1.1.x, 1.2 Dec 31, 2020
@Borda Borda added the design Includes a design discussion label Dec 31, 2020
@Borda Borda changed the base branch from master to release/1.2-dev December 31, 2020 08:15
@Borda
Copy link
Member

Borda commented Dec 31, 2020

@rohitgr7 as you are changing API we need to move it to 1.2
mind rebase on feature 1.2 🐰

@rohitgr7
Copy link
Contributor Author

I thought I created this branch on top of release branch only. Will update it.

Copy link
Contributor

@carmocca carmocca left a comment

Choose a reason for hiding this comment

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

LGTM. One thing:

Why not keep mode to avoid the API change?

@awaelchli
Copy link
Member

+1 for keeping mode please :)

@rohitgr7
Copy link
Contributor Author

rohitgr7 commented Jan 2, 2021

I did that to have the exception at one place for both the cases.

trainer = Trainer(weights_summary='sdf')
model.summarize(weights_summary='sdf')

Will update this then.

@rohitgr7 rohitgr7 changed the base branch from release/1.2-dev to master January 2, 2021 14:34
@rohitgr7 rohitgr7 requested a review from carmocca January 2, 2021 14:35
@Borda Borda removed the design Includes a design discussion label Jan 2, 2021
@Borda
Copy link
Member

Borda commented Jan 2, 2021

@rohitgr7 is it as a bugfix for master or a feature for 1.2? there is some confusion as it is a 1.2 milestone but the target is master

@rohitgr7 rohitgr7 modified the milestones: 1.2, 1.1.x Jan 2, 2021
@rohitgr7
Copy link
Contributor Author

rohitgr7 commented Jan 2, 2021

bugfix now. forgot to update the milestone. Updated!

@carmocca
Copy link
Contributor

carmocca commented Jan 2, 2021

I did that to have the exception at one place for both the cases.

Didn't realize the API was inconsistent. I like what you propose. We can do it in another PR

pytorch_lightning/core/lightning.py Outdated Show resolved Hide resolved
@rohitgr7 rohitgr7 enabled auto-merge (squash) January 4, 2021 19:25
@Borda Borda added the ready PRs ready to be merged label Jan 4, 2021
@rohitgr7 rohitgr7 merged commit 062800a into master Jan 5, 2021
@rohitgr7 rohitgr7 deleted the bugfix/model_sum branch January 5, 2021 07:43
Borda pushed a commit that referenced this pull request Jan 6, 2021
* Fix weights_summary

* use mode

* fix

* optional

* what was I thinking

(cherry picked from commit 062800a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants