-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Remove ModelSummary validation from train loop on_trainer_init #6610
Remove ModelSummary validation from train loop on_trainer_init #6610
Conversation
Hello @ananthsub! Thanks for updating this PR. There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-03-21 03:34:59 UTC |
ref_model.summarize(mode=self.weights_summary) | ||
else: | ||
raise MisconfigurationException("weights_summary can be None, " + ", ".join(ModelSummary.MODES)) | ||
ref_model.summarize(mode=self.weights_summary) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edenafek @awaelchli @justusschock the model summary could be another (small) component we could split out from the core lightning module and offer as a standalone utility. the constructor for the summary object could take:
- an nn.Module
- precision
- device
- mode
connecting it back into the trainer here would be easy. it's almost there now with the ModelSummary
object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related idea: #4541
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw it's already a standalone utility. It can be used like this:
summary = LayerSummary(model, mode=...)
print(summary)
As you say it could also support nn.Module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by standalone i mean no dependence on the lightning module. right now the precision and example inputs are looked up via attributes of model
inside of model summary, but these could be passed in explicitly to the model summary constructor. it's not a huge deal, but something small for people to see how lightning builds reusable components
Is this ready to review? If yes: please fill out the checklist in the original post, otherwise mark it as |
yes this is ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
What does this PR do?
training_loop.py
beginning withon_trainer_init
for better static analysis w/ mypy or Pyreweights_summary
acrossTrainLoop
andTrainer
- the validation and property setting was happening in both placesFixes #<issue_number>
Before submitting
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:
Did you have fun?
Make sure you had fun coding 🙃