]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
gguf : print error for GGUFv1 files (#3908)
authorGeorgi Gerganov <redacted>
Thu, 2 Nov 2023 14:22:30 +0000 (16:22 +0200)
committerGitHub <redacted>
Thu, 2 Nov 2023 14:22:30 +0000 (16:22 +0200)
ggml.c

diff --git a/ggml.c b/ggml.c
index d5a49d8e4f3148ede4c7f26ae1bee253e580cef5..605a27940fc81ff92b588ca5263bf4e9d1fb49ff 100644 (file)
--- a/ggml.c
+++ b/ggml.c
@@ -18884,6 +18884,13 @@ struct gguf_context * gguf_init_from_file(const char * fname, struct gguf_init_p
         ok = ok && gguf_fread_el(file, &ctx->header.n_tensors, sizeof(ctx->header.n_tensors), &offset);
         ok = ok && gguf_fread_el(file, &ctx->header.n_kv,      sizeof(ctx->header.n_kv),      &offset);
 
+        if (ctx->header.version == 1) {
+            fprintf(stderr, "%s: GGUFv1 is no longer supported. please use a more up-to-date version\n", __func__);
+            fclose(file);
+            gguf_free(ctx);
+            return NULL;
+        }
+
         if (!ok) {
             fprintf(stderr, "%s: failed to read header\n", __func__);
             fclose(file);