def total_train_batches(self) -> Union[int, float]:
        """The total number of training batches, which may change from epoch to epoch.

        Use this to set the total number of iterations in the progress bar. Can return ``inf`` if the training
        dataloader is of infinite size.

        """
        if self.trainer.max_epochs == -1 and self.trainer.max_steps is not None and self.trainer.max_steps > 0:
            remaining_steps = self.trainer.max_steps - self.trainer.global_step
            return min(self.trainer.num_training_batches, remaining_steps)
        return self.trainer.num_training_batches
The total number of training batches, which may change from epoch to epoch.

        Use this to set the total number of iterations in the progress bar. Can return ``inf`` if the training
        dataloader is of infinite size.

        
src/lightning/pytorch/callbacks/progress/progress_bar.py