class_docstr: Second stage pretraining of BERT based language model
  for entity linking task. An implementation of Liu et. al's
  NAACL 2021 paper Self-Alignment Pretraining for Biomedical Entity Representations.
class_docstr_tok: ["Second","stage","pretraining","of","BERT","based","language","model","for","entity","linking","task",".","An","implementation","of","Liu","et",".","al's","NAACL","2021","paper","Self-Alignment","Pretraining","for","Biomedical","Entity","Representations","."]
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`.
      """
      input_ids, input_type_ids, input_mask, concept_ids = batch
      with torch.no_grad():
          logits = self.forward(
              input_ids=input_ids,
              token_type_ids=input_type_ids,
              attention_mask=input_mask,
          )
          val_loss = self.loss(logits=logits, labels=concept_ids)
  
      # No hard examples found in batch,
      # val loss not used to update model weights
      if val_loss == 0:
          val_loss = None
      else:
          self.log("val_loss", val_loss)
          logging.info(f"val loss: {val_loss}")
  
      loss = {"val_loss": val_loss}
      self.validation_step_outputs.append(loss)
      return loss
  
imports: from typing import Dict, Optional
  import torch
  from omegaconf import DictConfig
  from pytorch_lightning import Trainer
  from transformers import AutoTokenizer
  from nemo.collections.common.losses import MultiSimilarityLoss
  from nemo.collections.nlp.data import EntityLinkingDataset
  from nemo.collections.nlp.models.nlp_model import NLPModel
  from nemo.core.classes.common import typecheck
  from nemo.core.classes.exportable import Exportable
  from nemo.core.neural_types import LogitsType, NeuralType
  from nemo.utils import logging
label_desc: Use image node_id 6 for calling the EntityLinkingModel obj's underlying member method code with example usage: obj.validation_step(batch, batch_idx) and returns: loss