Skip to content

Commit b451b1c

Browse files
akawrykowpkrmf
authored andcommitted
falcon : use stated vocab size (ggml-org#2914)
1 parent e2a7aa5 commit b451b1c

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)