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

Deprecate LightningModule.summarize() in favor of pl.utilities.model_summary.summarize() #8513

Merged
merged 32 commits into from
Aug 3, 2021

Conversation

samlurye
Copy link
Contributor

@samlurye samlurye commented Jul 21, 2021

Deprecate the method LightningModule.summarize and move it to its own function in pytorch_lightning/utilities/model_summary.py. Additionally, move LayerSummary and ModelSummary, along with all of their supporting functions, from pytorch_lightning/core/memory.py into the same model_summary.py file.

Fixes #8478

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

Did you have fun?

I made sure I had fun coding 🙃

samlurye and others added 4 commits July 21, 2021 14:55
Deprecate the method `LightningModule.summarize` and move it to its own function in `pytorch_lightning/utilities/model_summary.py`. Additionally, move `LayerSummary` and `ModelSummary`, along with all of their supporting functions, from `pytorch_lightning/core/memory.py` into the same `model_summary.py` file.
@codecov
Copy link

codecov bot commented Jul 21, 2021

Codecov Report

Merging #8513 (2dbffab) into master (16392a7) will increase coverage by 0%.
The diff coverage is 95%.

@@           Coverage Diff           @@
##           master   #8513    +/-   ##
=======================================
  Coverage      88%     89%            
=======================================
  Files         168     168            
  Lines       13975   14045    +70     
=======================================
+ Hits        12344   12462   +118     
+ Misses       1631    1583    -48     

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.

thanks for working on this @samlurye! I left a few small comments inline

pytorch_lightning/core/memory.py Outdated Show resolved Hide resolved
pytorch_lightning/core/memory.py Outdated Show resolved Hide resolved
tests/utilities/test_model_summary.py Outdated Show resolved Hide resolved
tests/utilities/test_model_summary.py Outdated Show resolved Hide resolved
pytorch_lightning/utilities/model_summary.py Show resolved Hide resolved
pytorch_lightning/core/lightning.py Outdated Show resolved Hide resolved
pytorch_lightning/core/lightning.py Outdated Show resolved Hide resolved
@pep8speaks
Copy link

pep8speaks commented Jul 21, 2021

Hello @samlurye! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

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

Comment last updated at 2021-08-03 21:28:36 UTC

@awaelchli awaelchli added feature Is an improvement or enhancement refactor design Includes a design discussion and removed feature Is an improvement or enhancement labels Jul 21, 2021
@samlurye samlurye requested a review from SkafteNicki as a code owner July 27, 2021 21:16
@mergify mergify bot removed the has conflicts label Jul 27, 2021
@Borda Borda changed the title Deprecate LightningModule.summarize() in favor of pytorch_lightning.utilities.model_summary.summarize() Deprecate LightningModule.summarize() in favor of pl.utilities.model_summary.summarize() Jul 28, 2021
pytorch_lightning/core/memory.py Outdated Show resolved Hide resolved
pytorch_lightning/core/memory.py Outdated Show resolved Hide resolved
pytorch_lightning/trainer/trainer.py Show resolved Hide resolved
pytorch_lightning/utilities/memory.py Show resolved Hide resolved
pytorch_lightning/utilities/memory.py Show resolved Hide resolved
pytorch_lightning/utilities/model_summary.py Show resolved Hide resolved
pytorch_lightning/utilities/model_summary.py Show resolved Hide resolved
pytorch_lightning/utilities/model_summary.py Show resolved Hide resolved
pytorch_lightning/utilities/model_summary.py Show resolved Hide resolved
pytorch_lightning/utilities/model_summary.py Show resolved Hide resolved
@mergify mergify bot added the ready PRs ready to be merged label Jul 29, 2021
@mergify mergify bot removed the has conflicts label Jul 30, 2021
@tchaton
Copy link
Contributor

tchaton commented Aug 2, 2021

Dear @samlurye,

The tests seems to be failing. Mind looking into that ?

Best,
T.C

tests/deprecated_api/test_remove_1-7.py Outdated Show resolved Hide resolved
tests/deprecated_api/test_remove_1-7.py Outdated Show resolved Hide resolved
@awaelchli awaelchli enabled auto-merge (squash) August 3, 2021 21:30
@awaelchli awaelchli merged commit f90849c into Lightning-AI:master Aug 3, 2021
@Borda Borda changed the title Deprecate LightningModule.summarize() in favor of pl.utilities.model_summary.summarize() Deprecate LightningModule.summarize() in favor of pl.utilities.model_summary.summarize() Mar 10, 2023
@Borda Borda mentioned this pull request Mar 10, 2023
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Includes a design discussion ready PRs ready to be merged refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate summarize() off LightningModule
7 participants