"...git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "30c44d431b007c78c9d283a27fdb171e071ea780"
Unverified Commit 72fa8d03 authored by Haozhe Ji's avatar Haozhe Ji Committed by GitHub
Browse files

add 'padding_idx=0' for BertEmbeddings

parent 7cc35c31
...@@ -238,9 +238,9 @@ class BertEmbeddings(nn.Module): ...@@ -238,9 +238,9 @@ class BertEmbeddings(nn.Module):
""" """
def __init__(self, config): def __init__(self, config):
super(BertEmbeddings, self).__init__() super(BertEmbeddings, self).__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size) self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=0)
self.position_embeddings = nn.Embedding(config.max_position_embeddings, config.hidden_size) self.position_embeddings = nn.Embedding(config.max_position_embeddings, config.hidden_size, padding_idx=0)
self.token_type_embeddings = nn.Embedding(config.type_vocab_size, config.hidden_size) self.token_type_embeddings = nn.Embedding(config.type_vocab_size, config.hidden_size, padding_idx=0)
# self.LayerNorm is not snake-cased to stick with TensorFlow model variable name and be able to load # self.LayerNorm is not snake-cased to stick with TensorFlow model variable name and be able to load
# any TensorFlow checkpoint file # any TensorFlow checkpoint file
......
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