class_docstr: Abstract base class for QA Datasets with common utility methods 
class_docstr_tok: ["Abstract","base","class","for","QA","Datasets","with","common","utility","methods"]
code: def __init__(
      self,
      data_file: str,
      processor: object,
      tokenizer: object,
      mode: str,
      num_samples: int,
      **kwargs,
  ):
      self.mode = mode
      self.data_file = data_file
      self.processor = processor
      self.tokenizer = tokenizer
      self.features = None
  
      if self.mode not in [
          TRAINING_MODE,
          EVALUATION_MODE,
          INFERENCE_MODE,
      ]:
          raise ValueError(
              f"mode should be either {TRAINING_MODE}, {EVALUATION_MODE}, {INFERENCE_MODE} but got {self.mode}"
          )
  
      # get examples from processor and keep according to limit
      self.examples = self.processor.get_examples()
      if num_samples == 0:
          raise ValueError(
              f"num_samples has to be positive or -1 (to use the entire dataset), however got {num_samples}."
          )
      elif num_samples > 0:
          self.examples = self.examples[:num_samples]
  
imports: import collections
  import pickle
  from functools import lru_cache
  from typing import List
  import psutil
  import torch
  from nemo.collections.nlp.data.data_utils import is_whitespace
  from nemo.collections.nlp.data.question_answering.data_processor.qa_processing import EVALUATION_MODE, INFERENCE_MODE, TRAINING_MODE
  from nemo.core.classes import Dataset
  from nemo.utils import logging
label_desc: Use image node_id 1 to create a new QADataset object from inherited base classes: Dataset with example: obj = QADataset(data_file, processor, tokenizer, mode, num_samples)