You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PyTorch _LRScheduler base class for schedulers supports passing epoch parameter to the lr_scheduler.step()function.
But when Lightning training loop updates learning rates, it doesn't pass the current epoch index. That leads to a wrong behaviour of those shedulers that relies on epoch param.
Some schedulers handle that under the hood, like CosineAnnealingWarmRestarts from PyTorch that increment last epoch index if epoch isn't provided. In my case I have a custom scheduler that updates learning rate after each batch via "interval": "step" and it also uses current epoch index. I can create a workaround for sure, but thought it'd be nice to get it fixed in the Pytorch Lightning too. Plus it wasn't obvious for me until I logged lr into tensorboard.
The text was updated successfully, but these errors were encountered:
Then it's an issue for all schedulers that update lr after each batch (like with "interval": "step") and rely on self.last_epoch. As it increments self.last_epoch after each batch, it basically becomes last step index instead of last epoch index.
PyTorch
_LRScheduler
base class for schedulers supports passingepoch
parameter to thelr_scheduler.step()
function.But when Lightning training loop updates learning rates, it doesn't pass the current epoch index. That leads to a wrong behaviour of those shedulers that relies on
epoch
param.Some schedulers handle that under the hood, like CosineAnnealingWarmRestarts from PyTorch that increment last epoch index if epoch isn't provided. In my case I have a custom scheduler that updates learning rate after each batch via
"interval": "step"
and it also uses current epoch index. I can create a workaround for sure, but thought it'd be nice to get it fixed in the Pytorch Lightning too. Plus it wasn't obvious for me until I logged lr into tensorboard.The text was updated successfully, but these errors were encountered: