From 2349ad50218bd59ebdcd53dc8a2f0cbf7683804d Mon Sep 17 00:00:00 2001 From: Wing Lian Date: Thu, 14 Sep 2023 23:21:21 -0400 Subject: [PATCH] don't resize embeddings if it's already large enough --- src/axolotl/utils/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/axolotl/utils/models.py b/src/axolotl/utils/models.py index eae08f7f70..4cbb4f173d 100644 --- a/src/axolotl/utils/models.py +++ b/src/axolotl/utils/models.py @@ -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")