mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2025-01-07 11:23:56 +01:00
gguf : start implementing gguf_file_saver (WIP)
This commit is contained in:
parent
a356b0e228
commit
b2440f1943
@ -647,9 +647,14 @@ struct gguf_file_saver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void write_hparams(enum llama_ftype new_ftype) {
|
void write_hparams(enum llama_ftype new_ftype) {
|
||||||
const llama_hparams & hparams = any_file_loader->hparams;
|
const int32_t n_kv = gguf_get_n_kv(any_file_loader->gguf_ctx);
|
||||||
GGML_UNUSED(hparams);
|
for (int i = 0; i < n_kv; ++i) {
|
||||||
GGML_UNUSED(new_ftype);
|
const char * key = gguf_get_key(any_file_loader->gguf_ctx, i);
|
||||||
|
if (strcmp(key, "general.quantization_version") == 0) {
|
||||||
|
file.write_val<uint32_t>("general.quantization_version", GGUF_TYPE_UINT32, new_ftype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_vocab() {
|
void write_vocab() {
|
||||||
@ -658,6 +663,10 @@ struct gguf_file_saver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void write_tensor(llama_load_tensor & tensor, enum ggml_type new_type, const void * new_data, size_t new_size) {
|
void write_tensor(llama_load_tensor & tensor, enum ggml_type new_type, const void * new_data, size_t new_size) {
|
||||||
|
GGML_UNUSED(tensor);
|
||||||
|
GGML_UNUSED(new_data);
|
||||||
|
GGML_UNUSED(new_size);
|
||||||
|
|
||||||
switch (new_type) {
|
switch (new_type) {
|
||||||
case GGML_TYPE_F32:
|
case GGML_TYPE_F32:
|
||||||
case GGML_TYPE_F16:
|
case GGML_TYPE_F16:
|
||||||
|
Loading…
Reference in New Issue
Block a user