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: Initializes the SAP-BERT model for entity linking.
docstr_tok: ["Initializes","the","SAP-BERT","model","for","entity","linking","."]
code: def __init__(self, cfg: DictConfig, trainer: Trainer = None):
      """Initializes the SAP-BERT model for entity linking."""
  
      # tokenizer needed before super().__init__() so dataset and loader can process data
      self._setup_tokenizer(cfg.tokenizer)
  
      super().__init__(cfg=cfg, trainer=trainer)
  
      # Token to use for the self-alignment loss, typically the first token, [CLS]
      self._idx_conditioned_on = 0
      self.loss = MultiSimilarityLoss()
  
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 2 to create a new EntityLinkingModel object from inherited base classes: NLPModel, Exportable with example: obj = EntityLinkingModel(cfg, trainer)