From 28abfc90fa9154be5ed9fded0870587aa6850820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Yusuf=20Sar=C4=B1g=C3=B6z?= Date: Fri, 11 Aug 2023 13:27:58 +0300 Subject: [PATCH] gguf : write metadata in gguf_file_saver (WIP) --- gguf-llama.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gguf-llama.cpp b/gguf-llama.cpp index 9ab770277..11dcb1cc5 100644 --- a/gguf-llama.cpp +++ b/gguf-llama.cpp @@ -655,11 +655,29 @@ struct gguf_file_saver { file.write_val("general.quantization_version", GGUF_TYPE_UINT32, new_ftype); } else { const gguf_type vtype = gguf_get_kv_type(any_file_loader->gguf_ctx, i); + + bool bool_val; + float f32_val; + int16_t i16_val; + int32_t i32_val; + switch(vtype) { case GGUF_TYPE_BOOL: + bool_val = gguf_get_val_bool(any_file_loader->gguf_ctx, i); + file.write_val(key, GGUF_TYPE_BOOL, bool_val); + break; case GGUF_TYPE_FLOAT32: + f32_val = gguf_get_val_f32(any_file_loader->gguf_ctx, i); + file.write_val(key, GGUF_TYPE_FLOAT32, f32_val); + break; case GGUF_TYPE_INT16: + i16_val = gguf_get_val_i16(any_file_loader->gguf_ctx, i); + file.write_val(key, GGUF_TYPE_INT16, i16_val); + break; case GGUF_TYPE_INT32: + i32_val = gguf_get_val_i32(any_file_loader->gguf_ctx, i); + file.write_val(key, GGUF_TYPE_INT32, i32_val); + break; case GGUF_TYPE_INT8: case GGUF_TYPE_STRING: case GGUF_TYPE_UINT16: