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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lightning Model module , get_model_size method #4807

Closed
kartik4949 opened this issue Nov 22, 2020 · 3 comments
Closed

Lightning Model module , get_model_size method #4807

kartik4949 opened this issue Nov 22, 2020 · 3 comments
Labels
design Includes a design discussion discussion In a discussion stage feature Is an improvement or enhancement help wanted Open to be worked on won't fix This will not be worked on

Comments

@kartik4949
Copy link
Contributor

馃殌 Feature

A get_model_size method in model module which return model size in megabyte based on precision.

Motivation

Just thinking out loud..

Additional context

We can add this in mode summary too

# ------------
# model
# ------------
model = LitClassifier(args.hidden_dim, args.learning_rate)
>> print(model.size)
>> 104.14281 Mb with fp32.
@kartik4949 kartik4949 added feature Is an improvement or enhancement help wanted Open to be worked on labels Nov 22, 2020
@awaelchli
Copy link
Member

That's a fun suggestion :)
I suppose a method is not suitable since this is just a information query and does not muatate the state of the model.

@awaelchli awaelchli added design Includes a design discussion discussion In a discussion stage information needed labels Nov 22, 2020
@kartik4949
Copy link
Contributor Author

kartik4949 commented Nov 22, 2020

@awaelchli what i meant was,

.
.
def _get_model_size():
   _precision = self.get_precision()
   _total_params = self.get_params()
   # calculate model_size based on _precision and _total_params
   return _size

@property
def size(self):
   return self._get_model_size()

.

:)

@stale
Copy link

stale bot commented Dec 22, 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 22, 2020
@stale stale bot closed this as completed Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Includes a design discussion discussion In a discussion stage 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

2 participants