Skip to content

Commit 4ff1046

Browse files
authored
gguf : print error for GGUFv1 files (#3908)
1 parent 21958bb commit 4ff1046

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ggml.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18884,6 +18884,13 @@ struct gguf_context * gguf_init_from_file(const char * fname, struct gguf_init_p
1888418884
ok = ok && gguf_fread_el(file, &ctx->header.n_tensors, sizeof(ctx->header.n_tensors), &offset);
1888518885
ok = ok && gguf_fread_el(file, &ctx->header.n_kv, sizeof(ctx->header.n_kv), &offset);
1888618886

18887+
if (ctx->header.version == 1) {
18888+
fprintf(stderr, "%s: GGUFv1 is no longer supported. please use a more up-to-date version\n", __func__);
18889+
fclose(file);
18890+
gguf_free(ctx);
18891+
return NULL;
18892+
}
18893+
1888718894
if (!ok) {
1888818895
fprintf(stderr, "%s: failed to read header\n", __func__);
1888918896
fclose(file);

0 commit comments

Comments
 (0)