-
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
Trainer "optimizers" attribute is None when saving checkpoint and callbacks list is not empty #2936
Comments
Additional info, here are the relevant methods in my GAN class: class GAN(LightningModule, ABC):
...
@abstractmethod
def g_optimizer(self) -> Optimizer:
pass
@abstractmethod
def d_optimizer(self) -> Optimizer:
pass
def configure_optimizers(self):
return self.g_optimizer(), self.d_optimizer()
class MnistGanDense(GAN):
...
def g_optimizer(self) -> Optimizer:
return optim.RMSprop(self.G.parameters(), self.hparams['learning_rate'])
def d_optimizer(self) -> Optimizer:
return optim.RMSprop(self.D.parameters(), self.hparams['learning_rate']) |
could you try 0.9.0rc12? |
Is there a way to do that with conda? |
inside your Conda environment you could also install it with pip |
Inside conda you can always install with pip:
If this is still an issue, happy to reopen |
This is still a problem for me. I updated to 0.9.1rc1 and still get this error. Here is my trace.
|
@williamFalcon could you open this again? I'm still getting the error as well |
@rohitgr7 didn't we recently make optimizers init to an empty list instead of None? I think this should solve the problem. Could you check? |
@awaelchli yes its an empty list now. But the code for lightning model defined above has optimizers defined, so am not sure yet what's the issue there. @import-antigravity mind check this on master? |
@deekshadangwal mind share full sample code so we can reproduce your issue? |
🐛 Bug
I'm training a GAN and I'm running a few custom callbacks as well. When the model attempts to save at the end of the first epoch, it crashes. Here's the very strange thing: I have the exact same code in a Jupyter notebook and the error doesn't occur.
To Reproduce
Steps to reproduce the behavior:
The bug does not occur when the
callbacks
list passed into the trainer is empty. None of the callbacks I'm using have anything to do with saving checkpoints, they're all for logging certain things about the model. Enabling any one of them causes the error. Running the exact same code in Jupyter results in no crashes.Stack trace:
Code sample
Here is the relevant part of my setup code:
Expected behavior
Environment
Please copy and paste the output from our
environment collection script
(or fill out the checklist below manually).
You can get the script and run it with:
and the same code in Jupyter:
conda
,pip
, source): condaThe text was updated successfully, but these errors were encountered: