class_docstr: Implements manual multi-process sharding (MMPS).
class_docstr_tok: ["Implements","manual","multi-process","sharding","(","MMPS",")","."]
code: def _read(self, file_path):
      start_index = 0
      step_size = 1
      worker_info = self.get_worker_info()
      if worker_info is not None:
          start_index += worker_info.id
          step_size *= worker_info.num_workers
      for i in islice(
          range(TOTAL_INSTANCES), start_index, None, step_size
      ):
          yield self.text_to_instance(i)
  
imports: from itertools import islice
  from typing import Optional, List, Set
  import pytest
  import torch.distributed
  from allennlp.common import util
  from allennlp.data import Instance
  from allennlp.data.dataset_readers import DatasetReader, WorkerInfo
  from allennlp.data.fields import LabelField
label_desc: Use image node_id 2 for calling the MockMmpsDatasetReader obj's underlying member method code with example usage: obj._read(file_path) without return types