class_docstr: Megatron style Random Batch Sampler.
  
  Major difference is that `__iter__` yields a local minibatch, not a microbatch.
  A local minibatch consists of `global_batch_size / data_parallel_size`
  
  Args:
      total_samples: The number of data samples, i.e. ``len(dataset)``.
      consumed_samples: The number of samples already consumed in pretraining.
      local_minibatch_size: The number of data in each batch returned from `__iter__`. Basically
          `local_minibatch_size = global_batch_size / data_parallel_size`.
      data_parallel_rank:
      data_parallel_size:
class_docstr_tok: ["Megatron","style","Random","Batch","Sampler",".","Major","difference","is","that","`","__iter__","`","yields","a","local","minibatch",",","not","a","microbatch",".","A","local","minibatch","consists","of","`","global_batch_size","\/","data_parallel_size","`","Args",":","total_samples",":","The","number","of","data","samples",",","i.e",".","``","len","(","dataset",")","``",".","consumed_samples",":","The","number","of","samples","already","consumed","in","pretraining",".","local_minibatch_size",":","The","number","of","data","in","each","batch","returned","from","`","__iter__","`",".","Basically","`","local_minibatch_size","=","global_batch_size","\/","data_parallel_size","`",".","data_parallel_rank",":","data_parallel_size",":"]
code: def __len__(self) -> int:
      return self.total_samples
  
imports: import abc
  import torch
label_desc: Use image node_id 2 for calling the MegatronPretrainingRandomSampler obj's underlying member method code with example usage: obj.__len__() and returns: self