MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / gguf_write_to_file

Function gguf_write_to_file

subprojects/llama.cpp/ggml/src/gguf.cpp:1409–1428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1407}
1408
1409bool gguf_write_to_file(const struct gguf_context * ctx, const char * fname, bool only_meta) {
1410 FILE * file = ggml_fopen(fname, "wb");
1411
1412 if (!file) {
1413 GGML_LOG_ERROR("%s: failed to open file '%s' for writing GGUF data\n", __func__, fname);
1414 return false;
1415 }
1416
1417 try {
1418 gguf_writer_file gw(file);
1419 gguf_write_out(ctx, gw, only_meta);
1420 } catch (const std::runtime_error& ex) {
1421 GGML_LOG_ERROR("%s: failed to write GGUF data into '%s': %s\n", __func__, fname, ex.what());
1422 fclose(file);
1423 return false;
1424 }
1425
1426 fclose(file);
1427 return true;
1428}
1429
1430size_t gguf_get_meta_size(const struct gguf_context * ctx) {
1431 // only return size

Callers 3

export_ggufFunction · 0.85
save_imatrixMethod · 0.85
saveMethod · 0.85

Calls 3

ggml_fopenFunction · 0.85
gguf_write_outFunction · 0.85
whatMethod · 0.45

Tested by

no test coverage detected