def max_batches(self) -> list[Union[int, float]]:
        """The max number of batches to run per dataloader."""
        max_batches = self._max_batches
        if not self.trainer.sanity_checking:
            return max_batches
        return [min(self.trainer.num_sanity_val_steps, batches) for batches in max_batches]
The max number of batches to run per dataloader.
src/lightning/pytorch/loops/evaluation_loop.py