def _num_ready_batches_reached(self) -> bool:
        """Checks if we are in the last batch or if there are more batches to follow."""
        epoch_finished_on_ready = self.batch_progress.current.ready == self.trainer.num_training_batches
        return epoch_finished_on_ready or self.batch_progress.is_last_batch
Checks if we are in the last batch or if there are more batches to follow.
src/lightning/pytorch/loops/training_epoch_loop.py