-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Check that model is configured correctly #1171
Comments
Hi! thanks for your contribution!, great first issue! |
I think this is a great idea! |
that is the |
I think what I propose and what For example, right now if I run the cpu template in basic_examples with I want to note, I consider this a feature to newcomers to the pytorch-lightning framework, since these are possible the most frequent user that may forget to implement specific methods. |
configure optimizers is optional. if you don’t define it we use adam lr = 0.001 so, if you do in fact forget it lol, we give you a good heuristic optimizer. however, maybe it’s better to fail? to force the user to define it? |
I was not aware that That method aside, not defining |
yeah, those errors should be nicer. would love a PR! @Borda fyi |
Yeah I like... 🤖 |
🚀 Feature
Check that model is correctly setup before training
Motivation
As of right now, there is no checking that essential methods like
training_step
,configure_optimizers
andtrain_dataloader
are proper defined in the model.For example if no
configure_optimizers
is defined the model will train, however nothing will happen. If notraining_step
is defined then this error occurs:AttributeError: 'NoneType' object has no attribute 'items'
,which are not very useful error message.
Additionally, it would be useful to check if a
val_dataloader
is defined thenvalidation_step
andvalidation_step_end
is also defined.Pitch
Some checking is already done here:
https://github.com/PyTorchLightning/pytorch-lightning/blob/c32e3f3ea57dd4439255b809ed5519608a585d73/pytorch_lightning/trainer/trainer.py#L649-L668
but that is checked if an user pass in dataloaders to the
.fit()
method. I propose to expand on this in a separate method, something likepossible with even more checks.
The text was updated successfully, but these errors were encountered: