code: def load_queries(self, reload=False):
      logging.info("loading training queries...")
      pickle_file = os.path.join(self._folder, self._cache_file)
      if (
          not reload
          and len(self._cache_file) > 0
          and os.access(pickle_file, os.R_OK)
      ):
          logging.info(f"  loading {pickle_file}")
          st = time.process_time()
          with open(pickle_file, "rb") as f:
              (
                  min_query_count,
                  days,
                  queries,
                  query_ids,
                  query_terms,
                  position_relevances,
              ) = pickle.load(f)
          if (
              min_query_count != self._min_query_count
              or days != self._days
          ):
              logging.info("  updated config from last cache, reload")
              self.load_queries(True)
          else:
              self._queries = queries
              self._query_ids = query_ids
              self._query_terms = query_terms
              self._position_relevances = position_relevances
              logging.info(
                  f"  loaded {len(self._queries)}, "
                  f"  time {time.process_time() - st}"
              )
      else:
          all_queries = {}
          for d in self._days:
              cache_file = os.path.join(
                  self._folder, f"{self._base_file_name}_{d:02}.pickle"
              )
              if os.access(cache_file, os.R_OK):
                  logging.info(f"  loading {cache_file}")
                  st = time.process_time()
                  with open(cache_file, "rb") as f:
                      queries = pickle.load(f)
                  if queries is None:
                      logging.warning(f"  loading {cache_file} failed!")
                      continue
                  logging.info(f"    loaded queries: {len(queries)}")
                  logging.info(
                      f"    loading time {time.process_time() - st}"
                  )
                  st = time.process_time()
                  for q in queries:
                      if q.query_id not in all_queries:
                          qr = TrainingQuery(q.query_id, q.query_terms)
                          all_queries[q.query_id] = qr
                      else:
                          qr = all_queries[q.query_id]
                      qr.add(q)
                  logging.info(
                      f"    process time {time.process_time() - st}"
                  )
              else:
                  logging.warning(f"    {cache_file} not accessible!")
          self._queries = []
          for v in all_queries.values():
              if v.count >= self._min_query_count:
                  v.finalize()
                  v.pack()
                  self._queries.append(v)
          self._query_ids = None
          self._query_terms = None
          self._position_relevances = None
          if len(self._cache_file) > 0:
              logging.info(f"saving training queries to {pickle_file}")
              try:
                  st = time.process_time()
                  with open(pickle_file, "wb") as f:
                      self._process_training_queries()
                      pickle.dump(
                          (
                              self._min_query_count,
                              self._days,
                              self._queries,
                              self._query_ids,
                              self._query_terms,
                              self._position_relevances,
                          ),
                          f,
                          protocol=pickle.HIGHEST_PROTOCOL,
                      )
                  logging.info(
                      f"  saving time {time.process_time() - st}"
                  )
              except Exception:
                  logging.warning(f"  {pickle_file} not accessible!")
      # self._query_ids = None
      # self._query_terms = None
      # self._position_relevances = None
      logging.info(f"loaded training queries: {len(self._queries)}")
  
imports: import argparse
  import json
  import logging
  import os
  import pickle
  import random
  import sys
  import time
  from typing import Iterable, List, Mapping, MutableMapping, Optional, Sequence, Tuple
  import numpy
  import torch
  import torch.multiprocessing
  from reagent.ope.estimators.estimator import Evaluator
  from reagent.ope.estimators.slate_estimators import DCGSlateMetric, ERRSlateMetric, FrechetDistribution, IPSEstimator, LogSample, NDCGSlateMetric, PBMEstimator, PseudoInverseEstimator, RankingDistribution, RewardDistribution, SlateContext, SlateEstimator, SlateEstimatorInput, SlateItemValues, SlateModel, SlateQuery, SlateSlots, SlateSlotValues
  from reagent.ope.utils import RunningAverage
label_desc: Use image node_id 2 for calling the TrainingDataset obj's underlying member method code with example usage: obj.load_queries(reload) without return types