Pytorch-lightning: How to scheduler.step() after every batch

Created on 19 Aug 2020  Â·  3Comments  Â·  Source: PyTorchLightning/pytorch-lightning

I want to make use of schedulers like torch.optim.lr_scheduler.CyclicLR & torch.optim.lr_scheduler.OneCycleLR
https://pytorch.org/docs/stable/optim.html
These schedulers require scheduler.step() to be callled after each batch.
How to achieve this is PyTorchLightning?

question

Most helpful comment

https://pytorch-lightning.readthedocs.io/en/latest/lightning-module.html#configure-optimizers

just set the interval:

scheduler = {
    'scheduler': scheduler,
    'interval': 'step', # or 'epoch'
    'frequency: 1
}

All 3 comments

Hi! thanks for your contribution!, great first issue!

https://pytorch-lightning.readthedocs.io/en/latest/lightning-module.html#configure-optimizers

just set the interval:

scheduler = {
    'scheduler': scheduler,
    'interval': 'step', # or 'epoch'
    'frequency: 1
}

@rohitgr7 Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jcreinhold picture jcreinhold  Â·  3Comments

justusschock picture justusschock  Â·  3Comments

as754770178 picture as754770178  Â·  3Comments

maxime-louis picture maxime-louis  Â·  3Comments

DavidRuhe picture DavidRuhe  Â·  3Comments