class_docstr: Base class for information retrieval models.
docstr: Lightning calls this inside the validation loop with the data from the validation dataloader
  passed in as `batch`.
docstr_tok: ["Lightning","calls","this","inside","the","validation","loop","with","the","data","from","the","validation","dataloader","passed","in","as","`","batch","`","."]
code: def validation_step(self, batch, batch_idx):
      """
      Lightning calls this inside the validation loop with the data from the validation dataloader
      passed in as `batch`.
      """
      scores, val_loss = self.compute_scores_and_loss(batch[:-2])
      query_ids, passage_ids = batch[-2:]
      data_for_val = {
          "val_loss": val_loss,
          "scores": scores,
          "query_ids": query_ids,
          "passage_ids": passage_ids,
      }
      self.validation_step_outputs.append(data_for_val)
      return data_for_val
  
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 7 for calling the BaseIRModel obj's underlying member method code with example usage: obj.validation_step(batch, batch_idx) and returns: data_for_val