Skip to content

Commit

Permalink
Merge pull request Taeung#791 from seemethere/fix_transformer
Browse files Browse the repository at this point in the history
word_language_model: Fix Transformer init_weights
  • Loading branch information
seemethere authored Jun 15, 2020
2 parents edfa9f2 + 13acec6 commit 59caa16
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion word_language_model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def _generate_square_subsequent_mask(self, sz):
def init_weights(self):
initrange = 0.1
nn.init.uniform_(self.encoder.weight, -initrange, initrange)
nn.init.zeros_(self.decoder)
nn.init.zeros_(self.decoder.weight)
nn.init.uniform_(self.decoder.weight, -initrange, initrange)

def forward(self, src, has_mask=True):
Expand Down

0 comments on commit 59caa16

Please sign in to comment.