fix #1819
This commit is contained in:
parent
3a8a50d4d4
commit
1fcd545c3d
|
@ -182,7 +182,7 @@ def resize_embedding_layer(model: "PreTrainedModel", tokenizer: "PreTrainedToken
|
||||||
return
|
return
|
||||||
|
|
||||||
old_vocab_size = model.get_input_embeddings().weight.size(0)
|
old_vocab_size = model.get_input_embeddings().weight.size(0)
|
||||||
if len(tokenizer) != old_vocab_size:
|
if len(tokenizer) > old_vocab_size:
|
||||||
model.resize_token_embeddings(len(tokenizer), pad_to_multiple_of=64)
|
model.resize_token_embeddings(len(tokenizer), pad_to_multiple_of=64)
|
||||||
new_vocab_size = model.get_input_embeddings().weight.size(0)
|
new_vocab_size = model.get_input_embeddings().weight.size(0)
|
||||||
logger.info("Resized token embeddings from {} to {}.".format(old_vocab_size, new_vocab_size))
|
logger.info("Resized token embeddings from {} to {}.".format(old_vocab_size, new_vocab_size))
|
||||||
|
|
Loading…
Reference in New Issue