class_docstr: Language model embeddings.
  
  Arguments:
      hidden_size: hidden size
      vocab_size: vocabulary size
      max_sequence_length: maximum size of sequence. This
                           is used for positional embedding
      embedding_dropout_prob: dropout probability for embeddings
      init_method: weight initialization method
      num_tokentypes: size of the token-type embeddings. 0 value
                      will ignore this embedding
      position_embedding_type: position embedding type determines whether we instantiate a learnable position embedding table.
docstr: Add token-type embedding. This function is provided so we can add
  token-type embeddings in case the pretrained model does not have it.
  This allows us to load the model normally and then add this embedding.
docstr_tok: ["Add","token-type","embedding",".","This","function","is","provided","so","we","can","add","token-type","embeddings","in","case","the","pretrained","model","does","not","have","it",".","This","allows","us","to","load","the","model","normally","and","then","add","this","embedding","."]
code: def add_tokentype_embeddings(self, num_tokentypes):
      """Add token-type embedding. This function is provided so we can add
      token-type embeddings in case the pretrained model does not have it.
      This allows us to load the model normally and then add this embedding.
      """
      if self.tokentype_embeddings is not None:
          raise Exception("tokentype embeddings is already initialized")
      if torch.distributed.get_rank() == 0:
          print(
              "adding embedding for {} tokentypes".format(
                  num_tokentypes
              ),
              flush=True,
          )
      self.num_tokentypes = num_tokentypes
      self.tokentype_embeddings = torch.nn.Embedding(
          num_tokentypes, self.hidden_size
      )
      # Initialize the token-type embeddings.
      self.init_method(self.tokentype_embeddings.weight)
  
imports: from ast import Mod
  import torch
  from nemo.collections.nlp.modules.common.megatron.adapters.parallel_adapters import AdapterName, PromptEncoderAdapterConfig
  from nemo.collections.nlp.modules.common.megatron.layer_type import LayerType
  from nemo.collections.nlp.modules.common.megatron.module import MegatronModule
  from nemo.collections.nlp.modules.common.megatron.position_embedding import ALiBiRelativePositionEmbedding, KERPLERelativePositionEmbedding, RotaryEmbedding, SandwichRelativePositionEmbedding
  from nemo.collections.nlp.modules.common.megatron.transformer import ParallelTransformer
  from nemo.collections.nlp.modules.common.megatron.utils import ApexGuardDefaults, get_linear_layer, init_method_normal, scaled_init_method_normal
  from nemo.collections.nlp.parts import utils_funcs
  from nemo.core import adapter_mixins
label_desc: Use image node_id 3 for calling the Embedding obj's underlying member method code with example usage: obj.add_tokentype_embeddings(num_tokentypes) without return types