From e2aa4d6a1a11086ac5641bfa2d9afdd41f312902 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 31 Oct 2024 12:38:20 -0700 Subject: [PATCH] Revert "Tied weights" This reverts commit 820cd4efef5d173f2200ef184b3d8856ba09d75b. --- unsloth/models/llama.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py index 0e9b70a8b2..c0175bbfaf 100644 --- a/unsloth/models/llama.py +++ b/unsloth/models/llama.py @@ -1838,8 +1838,7 @@ class FastLlamaModel: except: old_output_embedding = torch.zeros(0) # Check for tied weights as well - # is_tied = old_input_embedding.data_ptr() == old_output_embedding.data_ptr() - is_tied = model.config.tie_word_embeddings + is_tied = old_input_embedding.data_ptr() == old_output_embedding.data_ptr() # Check pad token's id -> we need to expand the embedding if len(tokenizer) > old_input_embedding.shape[0]: @@ -1888,9 +1887,6 @@ class FastLlamaModel: else: correct_dtype = old_input_embedding.dtype pass - - # Finally tie them if needed! - if is_tied: model.tie_weights() # Also patch all dtypes - BnB seems to not allocate the correct type? # BnB default dtype seems to be float16!