def get_num_training_steps(self) -> int:
        """Total training steps inferred from datamodule and devices."""
        if not getattr(self, "trainer", None):
            raise RuntimeError("The LightningModule isn't attached to the trainer yet.")

        if hasattr(self.trainer, "estimated_stepping_batches"):
            return self.trainer.estimated_stepping_batches

        from flash.core.trainer import Trainer

        return Trainer.estimated_stepping_batches.fget(self.trainer)
Total training steps inferred from datamodule and devices.
src/flash/core/model.py