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

DavidRuhe picture DavidRuhe  路  3Comments

williamFalcon picture williamFalcon  路  3Comments

anthonytec2 picture anthonytec2  路  3Comments

williamFalcon picture williamFalcon  路  3Comments

iakremnev picture iakremnev  路  3Comments