Skip to content

Commit

Permalink
Fix: Falcon tie_word_embeddings in GGUF (huggingface#35715)
Browse files Browse the repository at this point in the history
* fix falcon tie_word_embeddings

* fix style
  • Loading branch information
MekkCyber authored and bursteratom committed Jan 28, 2025
1 parent 1631439 commit 96f120d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/transformers/modeling_gguf_pytorch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,9 @@ def load_gguf_checkpoint(gguf_checkpoint_path, return_tensors=False, model_to_lo

# Handle tie_word_embeddings, if lm_head.weight is not present in tensors,
# tie_word_embeddings is true otherwise false
parsed_parameters["config"]["tie_word_embeddings"] = all(
"output.weight" != tensor.name for tensor in reader.tensors
exceptions = ["falcon"]
parsed_parameters["config"]["tie_word_embeddings"] = (
all("output.weight" != tensor.name for tensor in reader.tensors) or architecture in exceptions
)

# List all key-value pairs in a columnized format
Expand Down

0 comments on commit 96f120d

Please sign in to comment.