class_docstr: Class to read training datasets
class_docstr_tok: ["Class","to","read","training","datasets"]
code: def read(self, data_path: str, valid_size: int = None):
      if str(data_path).endswith(".pickle"):
          dataset = load_pickle(data_path)
      elif str(data_path).endswith(".json"):
          dataset = read_json(data_path)
      else:
          raise TypeError(f"Unsupported file type: {data_path}")
      if valid_size:
          dataset["valid"] = dataset["valid"][:valid_size]
  
      return dataset
  
file_path: DeepPavlov/deeppavlov/dataset_readers/sq_reader.py
imports: import json
  import pickle
  from typing import List
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.data.dataset_reader import DatasetReader
  from deeppavlov.core.common.file import load_pickle
  from deeppavlov.core.common.file import read_json
label_desc: Use image node_id 1 for calling the SQReader obj's underlying member method code with example usage: obj.read(data_path, valid_size) and returns: dataset