| 1526 | gguf_writer_file gw(file); |
| 1527 | gguf_write_out(ctx, gw, only_meta); |
| 1528 | } catch (const std::runtime_error& ex) { |
| 1529 | GGML_LOG_ERROR("%s: failed to write GGUF data: %s\n", __func__, ex.what()); |
| 1530 | return false; |
| 1531 | } |
| 1532 | return true; |
| 1533 | } |
| 1534 | |
| 1535 | bool gguf_write_to_file(const struct gguf_context * ctx, const char * fname, bool only_meta) { |
| 1536 | FILE * file = ggml_fopen(fname, "wb"); |
| 1537 | |
| 1538 | if (!file) { |
| 1539 | GGML_LOG_ERROR("%s: failed to open file '%s' for writing GGUF data\n", __func__, fname); |
| 1540 | return false; |
| 1541 | } |
| 1542 | |
| 1543 | const bool success = gguf_write_to_file_ptr(ctx, file, only_meta); |
| 1544 | if (!success) { |
| 1545 | GGML_LOG_ERROR("%s: failed to write GGUF data into '%s'\n", __func__, fname); |
| 1546 | } |
no test coverage detected