(self, config)
Construct the embedding module from word, position and token_type embeddings.
Construct the embedding module from word, position and token_type embeddings.
Construct the embedding module from word position and token_type embeddings .
def __init__(self, config):
        super(BERTEmbeddings, self).__init__()
        """Construct the embedding module from word, position and token_type embeddings.
        """
        self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size)
        self.position_embeddings = nn.Embedding(config.max_position_embeddings, config.hidden_size)
        self.token_type_embeddings = nn.Embedding(config.type_vocab_size, config.hidden_size)

        # self.LayerNorm is not snake-cased to stick with TensorFlow model variable name and be able to load
        # any TensorFlow checkpoint file
        self.LayerNorm = BERTLayerNorm(config)
        self.dropout = nn.Dropout(config.hidden_dropout_prob)
def __init__ ( self , config ) : super ( BERTEmbeddings , self ) . __init__ ( ) self . word_embeddings = nn . Embedding ( config . vocab_size , config . hidden_size ) self . position_embeddings = nn . Embedding ( config . max_position_embeddings , config . hidden_size ) self . token_type_embeddings = nn . Embedding ( config . type_vocab_size , config . hidden_size ) # self.LayerNorm is not snake-cased to stick with TensorFlow model variable name and be able to load # any TensorFlow checkpoint file self . LayerNorm = BERTLayerNorm ( config ) self . dropout = nn . Dropout ( config . hidden_dropout_prob )