Skip to content

Commit

Permalink
ggml : add friendlier error message to fopen errors (#8575)
Browse files Browse the repository at this point in the history
* Add additional error information when model files fail to load.

* Adding additional error information to most instances of fopen.
  • Loading branch information
HanClinto committed Jul 19, 2024
1 parent f299aa9 commit b57eb9c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ggml/src/ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -19019,7 +19019,7 @@ void ggml_graph_export(const struct ggml_cgraph * cgraph, const char * fname) {
FILE * fout = ggml_fopen(fname, "wb");

if (!fout) {
fprintf(stderr, "%s: failed to open %s\n", __func__, fname);
fprintf(stderr, "%s: failed to open %s: %s\n", __func__, fname, strerror(errno));
return;
}

Expand Down Expand Up @@ -19156,7 +19156,7 @@ struct ggml_cgraph * ggml_graph_import(const char * fname, struct ggml_context *
{
FILE * fin = ggml_fopen(fname, "rb");
if (!fin) {
fprintf(stderr, "%s: failed to open %s\n", __func__, fname);
fprintf(stderr, "%s: failed to open %s: %s\n", __func__, fname, strerror(errno));
return result;
}

Expand Down Expand Up @@ -20830,6 +20830,7 @@ struct gguf_context * gguf_init_empty(void) {
struct gguf_context * gguf_init_from_file(const char * fname, struct gguf_init_params params) {
FILE * file = ggml_fopen(fname, "rb");
if (!file) {
fprintf(stderr, "%s: failed to open '%s': '%s'\n", __func__, fname, strerror(errno));
return NULL;
}

Expand Down

0 comments on commit b57eb9c

Please sign in to comment.