Get max steps inside configure_optimizers

My LR scheduler needs to know the maximum number of steps in training. I want this to work even when self.trainer.max_steps is not specified.

I tried self.trainer.max_epochs * self.trainer.num_training_batches, but when configure_optimizers is called, self.trainer.num_training_batches is still 0.

Is there a way of doing this?

try this: Number of steps per epoch · Issue #5449 · PyTorchLightning/pytorch-lightning · GitHub

Thanks I’ll take a look