def __init__(
        self,
        source_items: List,
        seed: int = 0,
        shuffle: bool = True,
        num_instances: int = 1,
        instance_rank: int = 0,
    ):
        """
        Args:
            source_items: input list, must not be empty, must be small enough to fit into RAM entirely, and must support deepcopies
            seed: random seed used for shuffling
            shuffle: set False to bypass the shuffling. Then this is just a checkpointed version of itertools.cycle(). (Default: True)
            num_instances: number of instances of this iterator. Meant for use with multi-process data loading, e.g., in distributed training.
            instance_rank: rank of this instance of the iterator. Meant for use with multi-process data loading, e.g., in distributed training.
        """
        if not source_items:
            raise ValueError("source must not be empty")
        if instance_rank >= num_instances:
            raise ValueError("invalid instance_rank")
        self._source_items = copy.deepcopy(source_items)
        self._shuffle = shuffle
        self._seed = seed
        self._num_instances = num_instances
        self._instance_rank = instance_rank
        self.setstate(None)

        Args:
            source_items: input list, must not be empty, must be small enough to fit into RAM entirely, and must support deepcopies
            seed: random seed used for shuffling
            shuffle: set False to bypass the shuffling. Then this is just a checkpointed version of itertools.cycle(). (Default: True)
            num_instances: number of instances of this iterator. Meant for use with multi-process data loading, e.g., in distributed training.
            instance_rank: rank of this instance of the iterator. Meant for use with multi-process data loading, e.g., in distributed training.
        
kosmos-2/infinibatch/infinibatch/iterators.py