BERT-pytorch icon indicating copy to clipboard operation
BERT-pytorch copied to clipboard

Google AI 2018 BERT pytorch implementation

Results 66 BERT-pytorch issues
Sort by recently updated
recently updated
newest added

" def get_random_line(self): if self.on_memory: self.lines[random.randrange(len(self.lines))][1] " This code is to get the incorrect next sentence(isNotNext : 0), maybe it random get a lines it is (isnext:1)。

In language_model.py codes, class NextSentencePrediction and class MaskedLanguageModel has different input x in their forward function, In class NextSentencePrediction the input use "x[: 0] in "return self.softmax(self.linear(x[:, 0]))" but in...

You mentioned that > NOTICE : Your corpus should be prepared with two sentences in one line with tab(\t) separator and gave an example: > Welcome to the \t the...

question

class BERTLM:self.next_sentence = NextSentencePrediction(self.bert.hidden) This error appeared when I ran: 【AttributeError: type object 'BERT' has no attribute 'hidden'】 How to deal with it? Thank you!

```bash def get_random_line(self): ... return self.lines[random.randrange(len(self.lines))][1] ... ``` it should be changed to the following: ```bash def get_random_line(self,index): ... tmp = random.randrange(len(self.lines)) while(tmp == index): tmp = random.randrange(len(self.lines)) return self.lines[random.randrange(len(self.lines))][1]...

sublayerout = layerNorm(x +sublayer(x)) **首先是残差链接然后是层标准化** 在你代码中:sublayer.py中 应该是 def forward(self, x, sublayer): "Apply residual connection to any sublayer with the same size." # return x + self.dropout(sublayer(self.norm(x))) return self.norm( x +...