Skip to content

Commit fd4f14c

Browse files
authored
Fix: Falcon tie_word_embeddings in GGUF (#35715)
* fix falcon tie_word_embeddings * fix style
1 parent bef7dde commit fd4f14c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/transformers/modeling_gguf_pytorch_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,9 @@ def load_gguf_checkpoint(gguf_checkpoint_path, return_tensors=False, model_to_lo
400400

401401
# Handle tie_word_embeddings, if lm_head.weight is not present in tensors,
402402
# tie_word_embeddings is true otherwise false
403-
parsed_parameters["config"]["tie_word_embeddings"] = all(
404-
"output.weight" != tensor.name for tensor in reader.tensors
403+
exceptions = ["falcon"]
404+
parsed_parameters["config"]["tie_word_embeddings"] = (
405+
all("output.weight" != tensor.name for tensor in reader.tensors) or architecture in exceptions
405406
)
406407

407408
# List all key-value pairs in a columnized format

0 commit comments

Comments
 (0)