code: def __init__(
      self,
      dataset,
      num_replicas=None,  # world_size
      rank=None,  # local_rank
      shuffle=True,
      seed=0,
  ):
      super().__init__(
          dataset, num_replicas=num_replicas, rank=rank, shuffle=shuffle
      )
  
      # In distributed sampling, different ranks should sample
      # non-overlapped data in the dataset. Therefore, this function
      # is used to make sure that each rank shuffles the data indices
      # in the same order based on the same seed. Then different ranks
      # could use different indices to select non-overlapped data from the
      # same data list.
      self.seed = sync_random_seed(seed)
  
file_path: insightface/recognition/arcface_torch/utils/utils_distributed_sampler.py
imports: import math
  import os
  import random
  import numpy
  import torch
  import torch.distributed
  from torch.utils.data import DistributedSampler
label_desc: Use image node_id 1 to create a new DistributedSampler object from inherited base classes: _DistributedSampler with example: obj = DistributedSampler(dataset, num_replicas, rank, shuffle, seed)