Skip to content

Commit f18114c

Browse files
ggerganovmglambda
authored andcommitted
vocab : add dummy tokens for "no_vocab" type (ggml-org#11231)
* vocab : add dummy tokens for "no_vocab" type ggml-ci * vocab : minor [no ci]
1 parent b651eda commit f18114c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/llama-vocab.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,8 +1356,9 @@ void llama_vocab::impl::load(llama_model_loader & ml, const LLM_KV & kv) {
13561356

13571357
// read vocab size from metadata
13581358
uint32_t n_tokens = 0;
1359-
if (!ml.get_key(LLM_KV_VOCAB_SIZE, n_tokens, false)) {
1360-
LLAMA_LOG_WARN("%s: there is no vocab_size in metadata\n", __func__);
1359+
if (ml.get_key(LLM_KV_VOCAB_SIZE, n_tokens, false)) {
1360+
LLAMA_LOG_WARN("%s: adding %u dummy tokens\n", __func__, n_tokens);
1361+
id_to_token.resize(n_tokens);
13611362
}
13621363

13631364
return;

0 commit comments

Comments
 (0)