-
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
Fix for load_from_checkpoint
#2776
Conversation
load_from_checkpoint
load_from_checkpoint
@Borda : |
mind rather use one of our devel images - pytorchlightning/pytorch_lightning:cuda-extras-py3.7-torch1.6.0 |
load_from_checkpoint
load_from_checkpoint
@Borda Thanks! I found the problem and fixed it. The PR should be ready to be reviewed. |
cool, mind share what was the problem? |
Hello @jbschiratti! Thanks for updating this PR.
Comment last updated at 2020-10-05 15:25:01 UTC |
@jbschiratti seems like I made a mistake in rebasing, mind help to get it back... probably just yous your local version... |
This pull request is now in conflict... :( |
Hi @jbschiratti, I just looked at this PR to try and fix the failed tests, but I find it hard to understand all of your changes. I understand the issue in #2550 and why it happens, and I can verify that your PR fixes the problem, but unfortunately the current state seems to fail other tests. |
This pull request is now in conflict... :( |
@jbschiratti @awaelchli ... the added test also passes on master. Not sure what this is fixing now. Either the test is wrong, or this is not a bug on master |
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.
not sure it's a real bug
This pull request is now in conflict... :( |
…ve_hyperparameters() was not called.
…ve_hyperparameters() was not called.
This pull request is now in conflict... :( |
What does this PR do?
Aims at fixes #2550 and fixes #2769
This PR should allow users to load model weights from checkpoints even though
self.save_hyperparameters()
may not have been called before training. A test was added reproduce the problem described below.Context
In #2550, the user defines his own LightningModule called
MNISTModel
. In the__init__
method ofMNISTModel
, the call toself.save_hyperparameters()
is missed. Still, the model is trained and a model checkpoint is created. Later, the user wishes to restore model weights from this checkpoint using:However, this call to
load_from_checkpoint
raises an error. As described here, this error is raised because, inload_from_checkpoint
, the model to be restored receives multiple values for its class arguments. This problem is also described in #2769PR review
Anyone in the community is free to review the PR!
cc @Borda @rohitgr7