From 5b440385ae6949047b438b85e97c6b396bedc97c Mon Sep 17 00:00:00 2001 From: Ed Addario Date: Fri, 13 Jun 2025 07:40:39 +0100 Subject: [PATCH] Add UINT type to KV overrides --- common/common.cpp | 4 ++++ include/llama.h | 10 ++++++---- src/llama-model-loader.cpp | 8 ++++++++ src/llama-quant.cpp | 2 ++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/common/common.cpp b/common/common.cpp index 4cc40ed8b37a4..09edaf733516d 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -650,6 +650,10 @@ bool string_parse_kv_override(const char * data, std::vectorval_i64); } break; + case LLAMA_KV_OVERRIDE_TYPE_UINT: { + LLAMA_LOG_INFO("%" PRIu64 "\n", ovrd->val_u64); + } break; case LLAMA_KV_OVERRIDE_TYPE_FLOAT: { LLAMA_LOG_INFO("%.6f\n", ovrd->val_f64); } break; @@ -216,6 +220,10 @@ namespace GGUFMeta { target = ovrd->val_i64; return true; } + if (validate_override(LLAMA_KV_OVERRIDE_TYPE_UINT, ovrd)) { + target = ovrd->val_u64; + return true; + } return false; } diff --git a/src/llama-quant.cpp b/src/llama-quant.cpp index 159b1307a4c5d..102ba158e96d8 100644 --- a/src/llama-quant.cpp +++ b/src/llama-quant.cpp @@ -586,6 +586,8 @@ static void llama_model_quantize_impl(const std::string & fname_inp, const std:: gguf_set_val_f32(ctx_out.get(), o.key, o.val_f64); } else if (o.tag == LLAMA_KV_OVERRIDE_TYPE_INT) { gguf_set_val_i32(ctx_out.get(), o.key, o.val_i64); + } else if (o.tag == LLAMA_KV_OVERRIDE_TYPE_UINT) { + gguf_set_val_u32(ctx_out.get(), o.key, o.val_u64); } else if (o.tag == LLAMA_KV_OVERRIDE_TYPE_BOOL) { gguf_set_val_bool(ctx_out.get(), o.key, o.val_bool); } else if (o.tag == LLAMA_KV_OVERRIDE_TYPE_STR) {