Skip to content

Commit 5c872db

Browse files
authored
falcon : use stated vocab size (#2914)
1 parent 990a5e2 commit 5c872db

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

convert-falcon-hf-to-gguf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ def parse_args() -> argparse.Namespace:
137137

138138
print("gguf: get gpt2 tokenizer vocab")
139139

140-
vocab_size = len(tokenizer_json["model"]["vocab"])
140+
# The number of tokens in tokenizer.json can differ from the expected vocab size.
141+
# This causes downstream issues with mismatched tensor sizes when running the inference
142+
vocab_size = hparams["vocab_size"] if "vocab_size" in hparams else len(tokenizer_json["model"]["vocab"])
141143

142144
# ref: https://github.com/cmp-nct/ggllm.cpp/blob/master/falcon_convert.py
143145
tokenizer = AutoTokenizer.from_pretrained(dir_model)

0 commit comments

Comments
 (0)