diff --git a/gguf-llama.cpp b/gguf-llama.cpp index de937958b..5df684c19 100644 --- a/gguf-llama.cpp +++ b/gguf-llama.cpp @@ -730,7 +730,7 @@ struct gguf_file_saver { data[j] = val; } - file.write_arr(key, type, data); + file.write_arr(key, type, data); } void write_hparam_arr_f32(const std::string & key, enum gguf_type type, int i, int n_arr) { diff --git a/gguf-util.h b/gguf-util.h index b6a20cf5b..c22a14e9c 100644 --- a/gguf-util.h +++ b/gguf-util.h @@ -130,6 +130,7 @@ struct gguf_file { template void write_arr(const std::string & key, enum gguf_type type, const std::vector & val) { + static_assert(std::is_fundamental::value, "T must be a primitive type"); write_str(key); { const enum gguf_type tarr = GGUF_TYPE_ARRAY; @@ -151,7 +152,7 @@ struct gguf_file { fwrite(val.c_str(), n, 1, fp); } - void write_str(const std::string & key, enum gguf_type type, const std::vector & val) { + void write_arr(const std::string & key, enum gguf_type type, const std::vector & val) { write_str(key); { const enum gguf_type tarr = GGUF_TYPE_ARRAY;