"git@developer.sourcefind.cn:change/sglang.git" did not exist on "d297cda2c513e747c804cc4d2bd526ecb66349df"
Commit 1362b21b authored by Myle Ott's avatar Myle Ott Committed by Facebook Github Bot
Browse files

Correctly zero padding index in TransformerSentenceEncoder

Summary: Pull Request resolved: https://github.com/pytorch/fairseq/pull/912

Differential Revision: D16536561

Pulled By: myleott

fbshipit-source-id: 54c5c20a826a14f4e690770e027bcb282acdf911
parent 8207f263
......@@ -38,6 +38,7 @@ def init_bert_params(module):
module.bias.data.zero_()
if isinstance(module, nn.Embedding):
module.weight.data.normal_(mean=0.0, std=0.02)
module.weight.data[module.padding_idx].zero_()
if isinstance(module, MultiheadAttention):
module.in_proj_weight.data.normal_(mean=0.0, std=0.02)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment