class_docstr: Base class for information retrieval models.
code: def _setup_dataloader_from_config(self, cfg: DictConfig):
      dataset = BertInformationRetrievalDataset(
          tokenizer=self.tokenizer,
          passages=cfg.passages,
          queries=cfg.queries,
          query_to_passages=cfg.query_to_passages,
          num_negatives=cfg.num_negatives,
          psg_cache_format=cfg.get("psg_cache_format", "pkl"),
          max_query_length=cfg.get("max_query_length", 31),
          max_passage_length=cfg.get("max_passage_length", 190),
      )
  
      return torch.utils.data.DataLoader(
          dataset=dataset,
          batch_size=cfg.batch_size,
          shuffle=cfg.shuffle,
          num_workers=cfg.get("num_workers", 2),
          pin_memory=cfg.get("pin_memory", False),
          drop_last=cfg.get("drop_last", False),
      )
  
imports: import math
  from typing import Dict, Optional
  import numpy
  import torch
  from omegaconf import DictConfig, OmegaConf
  from pytorch_lightning import Trainer
  from nemo.collections.nlp.data import BertInformationRetrievalDataset
  from nemo.collections.nlp.models.nlp_model import NLPModel
  from nemo.collections.nlp.modules.common.lm_utils import get_lm_model
  from nemo.core.classes.common import typecheck
label_desc: Use image node_id 12 for calling the BaseIRModel obj's underlying member method code with example usage: obj._setup_dataloader_from_config(cfg) and returns: torch