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","."]
code: def forward(self, input_ids, token_type_ids, attention_mask):
      hidden_states = self.bert_model(
          input_ids=input_ids,
          token_type_ids=token_type_ids,
          attention_mask=attention_mask,
      )
      if isinstance(hidden_states, tuple):
          hidden_states = hidden_states[0]
  
      # normalize to unit sphere
      logits = torch.nn.functional.normalize(
          hidden_states[:, self._idx_conditioned_on], p=2, dim=1
      )
      return logits
  
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 4 for calling the EntityLinkingModel obj's underlying member method code with example usage: obj.forward(input_ids, token_type_ids, attention_mask) and returns: logits