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

Add total params to weights_summary table #4222

Closed
george-gca opened this issue Oct 18, 2020 · 4 comments
Closed

Add total params to weights_summary table #4222

george-gca opened this issue Oct 18, 2020 · 4 comments
Labels
duplicate This issue or pull request already exists feature Is an improvement or enhancement help wanted Open to be worked on won't fix This will not be worked on

Comments

@george-gca
Copy link
Contributor

🚀 Feature

Add total number of parameters when printing the weights_summary table.

Motivation

Since the total number of parameters for each layer is already calculated, it would be really informative if a total sum of number of parameters were also provided. Something like https://github.com/TylerYep/torch-summary or https://github.com/nmhkahn/torchsummaryX provide in their table.

Pitch

When printing weights_summary, there should also appear a summary of the whole model information, something like:

                      Totals
Total params          21.84k
Trainable params      21.84k
Non-trainable params     0.0

Alternatives

Maybe use one of the given tools (https://github.com/TylerYep/torch-summary or https://github.com/nmhkahn/torchsummaryX) inside?

Additional context

Example from https://github.com/TylerYep/torch-summary model summary:

==========================================================================================
Layer (type:depth-idx)                   Output Shape              Param #
==========================================================================================
├─Conv2d: 1-1                            [-1, 10, 24, 24]          260
├─Conv2d: 1-2                            [-1, 20, 8, 8]            5,020
├─Dropout2d: 1-3                         [-1, 20, 8, 8]            --
├─Linear: 1-4                            [-1, 50]                  16,050
├─Linear: 1-5                            [-1, 10]                  510
==========================================================================================
Total params: 21,840
Trainable params: 21,840
Non-trainable params: 0
==========================================================================================
Input size (MB): 0.00
Forward/backward pass size (MB): 0.05
Params size (MB): 0.08
Estimated Total Size (MB): 0.14
==========================================================================================

Example from https://github.com/nmhkahn/torchsummaryX model summary:

=================================================================
                Kernel Shape     Output Shape  Params Mult-Adds
Layer
0_conv1        [1, 10, 5, 5]  [1, 10, 24, 24]   260.0    144.0k
1_conv2       [10, 20, 5, 5]    [1, 20, 8, 8]   5.02k    320.0k
2_conv2_drop               -    [1, 20, 8, 8]       -         -
3_fc1              [320, 50]          [1, 50]  16.05k     16.0k
4_fc2               [50, 10]          [1, 10]   510.0     500.0
-----------------------------------------------------------------
                      Totals
Total params          21.84k
Trainable params      21.84k
Non-trainable params     0.0
Mult-Adds             480.5k
=================================================================
@george-gca george-gca added feature Is an improvement or enhancement help wanted Open to be worked on labels Oct 18, 2020
@github-actions
Copy link
Contributor

Hi! thanks for your contribution!, great first issue!

@SkafteNicki
Copy link
Member

Related to #1833
Please feel free to send a PR with the suggested enhancement!

@Borda Borda added the duplicate This issue or pull request already exists label Oct 19, 2020
@george-gca
Copy link
Contributor Author

Implemented in #4521

@stale
Copy link

stale bot commented Dec 5, 2020

This issue has been automatically marked as stale because it hasn't had any recent activity. This issue will be closed in 7 days if no further activity occurs. Thank you for your contributions, Pytorch Lightning Team!

@stale stale bot added the won't fix This will not be worked on label Dec 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists feature Is an improvement or enhancement help wanted Open to be worked on won't fix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants