code: def __init__(
      self,
      dataset,
      batch_size,
      pin_memory,
      local_rank,
      tput_timer,
      collate_fn=None,
      num_local_io_workers=None,
      data_sampler=None,
      data_parallel_world_size=None,
      data_parallel_rank=None,
      dataloader_drop_last=False,
  ):
      self.tput_timer = tput_timer
      self.batch_size = batch_size
  
      if local_rank >= 0:
          if data_sampler is None:
              data_sampler = DistributedSampler(
                  dataset=dataset,
                  num_replicas=data_parallel_world_size,
                  rank=data_parallel_rank,
              )
          device_count = 1
      else:
          if data_sampler is None:
              data_sampler = RandomSampler(dataset)
          device_count = torch.cuda.device_count()
          batch_size *= device_count
  
      if num_local_io_workers is None:
          num_local_io_workers = 2 * device_count
  
      self.num_local_io_workers = num_local_io_workers
      self.data_sampler = data_sampler
      self.dataset = dataset
      self.collate_fn = collate_fn
      self.device_count = device_count
      self.batch_size = batch_size
      self.pin_memory = pin_memory
      self.data = None
      self.dataloader_drop_last = dataloader_drop_last
  
      if self.dataloader_drop_last:
          self.len = len(self.data_sampler) // self.batch_size
      else:
          from math import ceil
  
          self.len = ceil(len(self.data_sampler) / self.batch_size)
  
file_path: H2O/h2o_flexgen/benchmark/third_party/DeepSpeed/deepspeed/runtime/dataloader.py
imports: import torch
  from torch.utils.data import DataLoader, RandomSampler
  from torch.utils.data.distributed import DistributedSampler
label_desc: Use image node_id 1 to create a new DeepSpeedDataLoader object from inherited base classes: object with example: obj = DeepSpeedDataLoader(dataset, batch_size, pin_memory, local_rank, tput_timer, collate_fn, num_local_io_workers, data_sampler, data_parallel_world_size, data_parallel_rank, dataloader_drop_last)