Skip to content

Commit

Permalink
don't resize embeddings if it's already large enough
Browse files Browse the repository at this point in the history
  • Loading branch information
winglian committed Sep 15, 2023
1 parent 2414673 commit 2349ad5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/axolotl/utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ def load_model(
if cfg.resize_token_embeddings_to_32x
else len(tokenizer)
)
model.resize_token_embeddings(embeddings_len)
if model.get_input_embeddings().num_embeddings < embeddings_len:
model.resize_token_embeddings(embeddings_len)

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

0 comments on commit 2349ad5

Please sign in to comment.