class_docstr: Base class for information retrieval models.
docstr: Lightning calls this inside the training loop with the data from the training dataloader
  passed in as `batch`.
docstr_tok: ["Lightning","calls","this","inside","the","training","loop","with","the","data","from","the","training","dataloader","passed","in","as","`","batch","`","."]
code: def training_step(self, batch, batch_idx):
      """
      Lightning calls this inside the training loop with the data from the training dataloader
      passed in as `batch`.
      """
      scores, train_loss = self.compute_scores_and_loss(batch[:-2])
      tensorboard_logs = {
          "train_loss": train_loss,
          "lr": self._optimizer.param_groups[0]["lr"],
      }
      return {"loss": train_loss, "log": tensorboard_logs}
  
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 6 for calling the BaseIRModel obj's underlying member method code with example usage: obj.training_step(batch, batch_idx) and returns: dict