Skip to content

Commit

Permalink
set vocab size and tie weights if not resizing embeddings
Browse files Browse the repository at this point in the history
  • Loading branch information
winglian committed Sep 15, 2023
1 parent 2349ad5 commit 2841fdd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/axolotl/utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ def load_model(
)
if model.get_input_embeddings().num_embeddings < embeddings_len:
model.resize_token_embeddings(embeddings_len)
else:
model.vocab_size = len(tokenizer)
model.config.vocab_size = len(tokenizer)
model.tie_weights()

if (
hasattr(model.config, "max_position_embeddings")
Expand Down

0 comments on commit 2841fdd

Please sign in to comment.