class_docstr: Construct the embeddings from word, position and token_type embeddings.
  Details in the paper:
  [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding, Devlin et al, 2019]
  (https://api.semanticscholar.org/CorpusID:52967399)
  
  # Parameters
  
  vocab_size : `int`
      The size of the input vocab.
  embedding_size : `int`
      The `embedding_dim` of all the embedding layers.
  pad_token_id : `int` (default = `0`)
      The token id of the `<pad>` token.
  max_position_embeddings : `int` (default = `512`)
      The maximum number of positions.
  type_vocab_size : `int` (default = `2`)
      The size of the input token_type vocab.
  dropout : `int` (default = `0.1`)
      The probability of an element to be zeroed.
  output_size : `int`, optional (default = `None`)
      Optionally apply a linear transform after the dropout, projecting to `output_size`.
class_docstr_tok: ["Construct","the","embeddings","from","word",",","position","and","token_type","embeddings",".","Details","in","the","paper",":","[","BERT",":","Pre-training","of","Deep","Bidirectional","Transformers","for","Language","Understanding",",","Devlin","et","al",",","2019","]","(","https",":","\/\/api.semanticscholar.org\/CorpusID:52967399",")","#","Parameters","vocab_size",":","`","int","`","The","size","of","the","input","vocab",".","embedding_size",":","`","int","`","The","`","embedding_dim","`","of","all","the","embedding","layers",".","pad_token_id",":","`","int","`","(","default","=","`","0","`",")","The","token","id","of","the","`","<","pad",">","`","token",".","max_position_embeddings",":","`","int","`","(","default","=","`","512","`",")","The","maximum","number","of","positions",".","type_vocab_size",":","`","int","`","(","default","=","`","2","`",")","The","size","of","the","input","token_type","vocab",".","dropout",":","`","int","`","(","default","=","`","0.1","`",")","The","probability","of","an","element","to","be","zeroed",".","output_size",":","`","int","`",",","optional","(","default","=","`","None","`",")","Optionally","apply","a","linear","transform","after","the","dropout",",","projecting","to","`","output_size","`","."]
code: def _from_config(cls, config: "PretrainedConfig", **kwargs):
      final_kwargs = {
          "vocab_size": config.vocab_size,
          "pad_token_id": config.pad_token_id,
          "max_position_embeddings": config.max_position_embeddings,
          "type_vocab_size": config.type_vocab_size,
          "layer_norm_eps": config.layer_norm_eps,
      }
      # For Albert, the embedding size is different than the hidden size used
      # in the model, so a linear transform is applied.
      if hasattr(config, "embedding_size"):
          final_kwargs["embedding_size"] = config.embedding_size
          final_kwargs["output_size"] = config.hidden_size
      else:
          final_kwargs["embedding_size"] = config.hidden_size
      if config.model_type == "roberta":
          final_kwargs["position_pad_token_id"] = config.pad_token_id
      final_kwargs.update(**kwargs)
      return cls(**final_kwargs)
  
file_path: allennlp/allennlp/modules/transformer/transformer_embeddings.py
imports: from typing import Optional, TYPE_CHECKING
  import torch
  from allennlp.common import FromParams
  from allennlp.modules.transformer.layer_norm import LayerNorm
  from allennlp.modules.transformer.transformer_module import TransformerModule
label_desc: Use image node_id 3 for calling the TransformerEmbeddings obj's underlying member method code with example usage: obj._from_config(cls, config) and returns: cls