MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / gguf_write_to_file

Function gguf_write_to_file

ggml.c:20370–20385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20368}
20369
20370void gguf_write_to_file(const struct gguf_context * ctx, const char * fname, bool only_meta) {
20371 FILE * file = fopen(fname, "wb");
20372 if (!file) {
20373 GGML_ASSERT(false && "failed to open file for writing");
20374 }
20375
20376 struct gguf_buf buf = gguf_buf_init(16*1024);
20377
20378 gguf_write_to_buf(ctx, &buf, only_meta);
20379
20380 fwrite(buf.data, 1, buf.offset, file);
20381
20382 gguf_buf_free(buf);
20383
20384 fclose(file);
20385}
20386
20387size_t gguf_get_meta_size(const struct gguf_context * ctx) {
20388 // no allocs - only compute size

Callers 5

save_llama_model_fileFunction · 0.50
save_checkpoint_fileFunction · 0.50
save_as_llama_modelFunction · 0.50
gguf_ex_writeFunction · 0.50

Calls 3

gguf_buf_initFunction · 0.85
gguf_buf_freeFunction · 0.85
gguf_write_to_bufFunction · 0.70

Tested by

no test coverage detected