Applied patch to OpenAI GPT, RoBERTa, TransfoL, XLM and XLNet
This commit is contained in:
@@ -168,7 +168,7 @@ class RobertaModel(BertModel):
|
||||
super(RobertaModel, self).__init__(config)
|
||||
|
||||
self.embeddings = RobertaEmbeddings(config)
|
||||
self.apply(self.init_weights)
|
||||
self.init_weights()
|
||||
|
||||
def forward(self, input_ids, token_type_ids=None, attention_mask=None, position_ids=None, head_mask=None):
|
||||
if input_ids[:, 0].sum().item() != 0:
|
||||
@@ -220,7 +220,7 @@ class RobertaForMaskedLM(BertPreTrainedModel):
|
||||
self.roberta = RobertaModel(config)
|
||||
self.lm_head = RobertaLMHead(config)
|
||||
|
||||
self.apply(self.init_weights)
|
||||
self.init_weights()
|
||||
self.tie_weights()
|
||||
|
||||
def tie_weights(self):
|
||||
|
||||
Reference in New Issue
Block a user