Closed yikuanli closed 3 years ago
Hi! thanks for your contribution!, great first issue!
Which optimizer and scheduler are you using? If you are using a custom optimizer, you need to update the code of the step()
function to take in a closure. PyTorch optimizer class implements the step method with the closure parameter in the latest version.
thanks, I now upgrade it to the latest version and seems the latest bolts solve the problem.
Oh, if you were using the LARS wrapper form bolts, then the latest version has the step method taking in a closure. That should solve it.
Should I close this issue then?
yes, thanks a lot
❓ Questions and Help
I am using pytorch 1.6 and pytorch lightning 1.0.8.
Before I upgrade my pytorch-lighing from 1.0.2 to 1.0.8, everything works fine, today I upgrade to 1.0.8 to try some new metrics, but got this error.
File "main.py", line 68, in main trainer.fit(model, trainloader, evalloader) File "/home/yikuan/anaconda/envs/py3/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 444, in fit results = self.accelerator_backend.train() File "/home/yikuan/anaconda/envs/py3/lib/python3.7/site-packages/pytorch_lightning/accelerators/gpu_accelerator.py", line 63, in train results = self.train_or_test() File "/home/yikuan/anaconda/envs/py3/lib/python3.7/site-packages/pytorch_lightning/accelerators/accelerator.py", line 74, in train_or_test results = self.trainer.train() File "/home/yikuan/anaconda/envs/py3/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 493, in train self.train_loop.run_training_epoch() File "/home/yikuan/anaconda/envs/py3/lib/python3.7/site-packages/pytorch_lightning/trainer/training_loop.py", line 561, in run_training_epoch batch_output = self.run_training_batch(batch, batch_idx, dataloader_idx) File "/home/yikuan/anaconda/envs/py3/lib/python3.7/site-packages/pytorch_lightning/trainer/training_loop.py", line 728, in run_training_batch self.optimizer_step(optimizer, opt_idx, batch_idx, train_step_and_backward_closure) File "/home/yikuan/anaconda/envs/py3/lib/python3.7/site-packages/pytorch_lightning/trainer/training_loop.py", line 470, in optimizer_step optimizer, batch_idx, opt_idx, train_step_and_backward_closure File "/home/yikuan/anaconda/envs/py3/lib/python3.7/site-packages/pytorch_lightning/accelerators/accelerator.py", line 130, in optimizer_step using_lbfgs=is_lbfgs File "/home/yikuan/anaconda/envs/py3/lib/python3.7/site-packages/pytorch_lightning/core/lightning.py", line 1270, in optimizer_step optimizer.step(closure=optimizer_closure) File "/home/yikuan/anaconda/envs/py3/lib/python3.7/site-packages/torch/optim/lr_scheduler.py", line 67, in wrapper return wrapped(*args, *kwargs) File "/home/yikuan/anaconda/envs/py3/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 15, in decorate_context return func(args, **kwargs) TypeError: step() got an unexpected keyword argument 'closure' (py3) yikuan@deepmedicine:~/project/version_control/HiBEHRT-BYOL$ TypeError: step() got an unexpected keyword argument 'closure'