Skip to content

Commit a5e87bf

Browse files
committed
llama: fixed n_vocab for no_vocab models
1 parent 23e0d70 commit a5e87bf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/llama.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6061,8 +6061,13 @@ static void llm_load_vocab(
60616061
vocab.special_mask_id = -1;
60626062
vocab.linefeed_id = -1;
60636063

6064+
// read vocab size from metadata
6065+
ml.get_key(LLM_KV_VOCAB_SIZE, vocab.n_vocab);
6066+
60646067
return;
6065-
} else if (tokenizer_model == "llama") {
6068+
}
6069+
6070+
if (tokenizer_model == "llama") {
60666071
vocab.type = LLAMA_VOCAB_TYPE_SPM;
60676072

60686073
// default special tokens

0 commit comments

Comments
 (0)