gguf : start implementing quantization (WIP)

This commit is contained in:
M. Yusuf Sarıgöz 2023-08-12 12:01:17 +03:00
parent 0e1a3c7e7d
commit c4f02b4f74
2 changed files with 5 additions and 2 deletions

View File

@ -778,8 +778,7 @@ struct gguf_file_saver {
}
write_tensor_info(tensor);
// file.write_raw(new_data);
GGML_UNUSED(new_data);
file.write_raw(new_data, new_size);
size_t padded_size = GGML_PAD(new_size, GGUF_DEFAULT_ALIGNMENT); // TODO: handle custom alignment
size_t pad = padded_size - new_size;
file.write_zeros(pad);

View File

@ -123,6 +123,10 @@ struct gguf_file {
return fwrite((const char *) &val, sizeof(val), 1, fp);
}
void write_raw(const void * data, size_t size) {
fwrite(data, size, 1, fp);
}
template<typename T>
void write_val(const std::string & key, enum gguf_type type, const T & val) {
write_str(key);