@@ -3707,7 +3707,7 @@ struct llama_model_loader {
3707
3707
}
3708
3708
3709
3709
if (param_overrides_p != nullptr) {
3710
- for (const struct llama_model_kv_override *p = param_overrides_p; p->key[0] != 0; p++) {
3710
+ for (const struct llama_model_kv_override * p = param_overrides_p; p->key[0] != 0; p++) {
3711
3711
kv_overrides.insert({std::string(p->key), *p});
3712
3712
}
3713
3713
}
@@ -3875,7 +3875,7 @@ struct llama_model_loader {
3875
3875
ftype = (llama_ftype) (ftype | LLAMA_FTYPE_GUESSED);
3876
3876
3877
3877
{
3878
- const int kid = gguf_find_key(meta, "general.file_type");
3878
+ const int kid = gguf_find_key(meta, "general.file_type"); // TODO: use LLM_KV
3879
3879
if (kid >= 0) {
3880
3880
ftype = (llama_ftype) gguf_get_val_u32(meta, kid);
3881
3881
}
@@ -5369,6 +5369,7 @@ static void llm_load_vocab(
5369
5369
if (merges_keyidx == -1) {
5370
5370
throw std::runtime_error("cannot find tokenizer merges in model file\n");
5371
5371
}
5372
+
5372
5373
const int n_merges = gguf_get_arr_n(ctx, merges_keyidx);
5373
5374
for (int i = 0; i < n_merges; i++) {
5374
5375
const std::string word = gguf_get_arr_str(ctx, merges_keyidx, i);
@@ -5407,16 +5408,6 @@ static void llm_load_vocab(
5407
5408
vocab.special_cls_id = -1;
5408
5409
vocab.special_mask_id = -1;
5409
5410
5410
- const int add_space_prefix_keyidx = gguf_find_key(ctx, kv(LLM_KV_TOKENIZER_ADD_PREFIX).c_str());
5411
- if (add_space_prefix_keyidx != -1) {
5412
- vocab.tokenizer_add_space_prefix = gguf_get_val_bool(ctx, add_space_prefix_keyidx);
5413
- } // The default value of add_space_prefix is true.
5414
-
5415
- const int remove_extra_whitespaces_keyidx = gguf_find_key(ctx, kv(LLM_KV_TOKENIZER_REMOVE_EXTRA_WS).c_str());
5416
- if (remove_extra_whitespaces_keyidx != -1) {
5417
- vocab.tokenizer_remove_extra_whitespaces = gguf_get_val_bool(ctx, remove_extra_whitespaces_keyidx);
5418
- } // The default value of remove_extra_whitespaces is false.
5419
-
5420
5411
const int precompiled_charsmap_keyidx = gguf_find_key(ctx, kv(LLM_KV_TOKENIZER_PRECOMPILED_CHARSMAP).c_str());
5421
5412
if (precompiled_charsmap_keyidx != -1) {
5422
5413
size_t n_precompiled_charsmap = gguf_get_arr_n(ctx, precompiled_charsmap_keyidx);
@@ -5553,10 +5544,8 @@ static void llm_load_vocab(
5553
5544
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
5554
5545
}
5555
5546
5556
- const int add_space_prefix_keyidx = gguf_find_key(ctx, kv(LLM_KV_TOKENIZER_ADD_PREFIX).c_str());
5557
- if (add_space_prefix_keyidx != -1) {
5558
- vocab.tokenizer_add_space_prefix = gguf_get_val_bool(ctx, add_space_prefix_keyidx);
5559
- }
5547
+ ml.get_key(LLM_KV_TOKENIZER_ADD_PREFIX, vocab.tokenizer_add_space_prefix, false);
5548
+ ml.get_key(LLM_KV_TOKENIZER_REMOVE_EXTRA_WS, vocab.tokenizer_remove_extra_whitespaces, false);
5560
5549
}
5561
5550
5562
5551
const int token_idx = gguf_find_key(ctx, kv(LLM_KV_TOKENIZER_LIST).c_str());
@@ -18288,8 +18277,9 @@ static void llama_model_quantize_internal(const std::string & fname_inp, const s
18288
18277
18289
18278
// copy the KV pairs from the input file
18290
18279
gguf_set_kv (ctx_out, ml.meta);
18291
- gguf_set_val_u32(ctx_out, "general.quantization_version", GGML_QNT_VERSION);
18292
- gguf_set_val_u32(ctx_out, "general.file_type", ftype);
18280
+ gguf_set_val_u32(ctx_out, "general.quantization_version", GGML_QNT_VERSION); // TODO: use LLM_KV
18281
+ gguf_set_val_u32(ctx_out, "general.file_type", ftype); // TODO: use LLM_KV
18282
+
18293
18283
// Remove split metadata
18294
18284
gguf_remove_key(ctx_out, ml.llm_kv(LLM_KV_SPLIT_NO).c_str());
18295
18285
gguf_remove_key(ctx_out, ml.llm_kv(LLM_KV_SPLIT_COUNT).c_str());
0 commit comments