llama : fix quantization using gguf tool

This commit is contained in:
Georgi Gerganov 2023-08-15 10:55:42 +03:00
parent a82e3a4d92
commit 66ce19aecb
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
2 changed files with 3 additions and 2 deletions

View file

@ -730,7 +730,7 @@ struct gguf_file_saver {
data[j] = val; data[j] = val;
} }
file.write_arr<std::string>(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) { void write_hparam_arr_f32(const std::string & key, enum gguf_type type, int i, int n_arr) {

View file

@ -130,6 +130,7 @@ struct gguf_file {
template<typename T> template<typename T>
void write_arr(const std::string & key, enum gguf_type type, const std::vector<T> & val) { void write_arr(const std::string & key, enum gguf_type type, const std::vector<T> & val) {
static_assert(std::is_fundamental<T>::value, "T must be a primitive type");
write_str(key); write_str(key);
{ {
const enum gguf_type tarr = GGUF_TYPE_ARRAY; const enum gguf_type tarr = GGUF_TYPE_ARRAY;
@ -151,7 +152,7 @@ struct gguf_file {
fwrite(val.c_str(), n, 1, fp); fwrite(val.c_str(), n, 1, fp);
} }
void write_str(const std::string & key, enum gguf_type type, const std::vector<std::string> & val) { void write_arr(const std::string & key, enum gguf_type type, const std::vector<std::string> & val) {
write_str(key); write_str(key);
{ {
const enum gguf_type tarr = GGUF_TYPE_ARRAY; const enum gguf_type tarr = GGUF_TYPE_ARRAY;