gguf : gguf counterpart of llama-util.h

This commit is contained in:
M. Yusuf Sarıgöz 2023-08-02 11:13:56 +03:00
parent 1b4f9c8eb9
commit cf365fbc20
2 changed files with 455 additions and 7 deletions

View file

@ -1,5 +1,5 @@
#include "ggml.h"
#include "llama-util.h"
#include "gguf-util.h"
#include <cstdio>
#include <cinttypes>
@ -375,11 +375,8 @@ bool gguf_ex_read_2(const std::string & fname) {
struct gguf_context * ctx = gguf_init_from_file(fname.c_str(), params);
// TODO: mmap based on tensor infos
struct llama_file file(fname.c_str(), "rb");
llama_mmap data_mmap(&file, 0, false);
struct gguf_file file(fname.c_str(), "rb");
gguf_mmap data_mmap(&file, 0, false);
const int n_tensors = gguf_get_n_tensors(ctx);
for (int i = 0; i < n_tensors; ++i) {
@ -405,7 +402,7 @@ fprintf(stdout, "%s: ctx_data size: %zu\n", __func__, ggml_get_mem_size(ctx_data
ggml_free(ctx_data);
gguf_free(ctx);
return true;
}