]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
ggml : add friendlier error message to fopen errors (llama/8575)
authorClint Herron <redacted>
Fri, 19 Jul 2024 11:05:45 +0000 (07:05 -0400)
committerGeorgi Gerganov <redacted>
Thu, 8 Aug 2024 19:48:46 +0000 (22:48 +0300)
* Add additional error information when model files fail to load.

* Adding additional error information to most instances of fopen.

ggml/src/ggml.c

index f98d73dd5f2cc70d77825c70f6b48010825c6689..e89efb32f3d674e3760a94af2bf87d0cc3a5cb65 100644 (file)
@@ -19018,7 +19018,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;
         }
 
@@ -19155,7 +19155,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;
         }
 
@@ -20829,6 +20829,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;
     }