gguf : print error for GGUFv1 files (#3908)

This commit is contained in:
Georgi Gerganov 2023-11-02 16:22:30 +02:00 committed by GitHub
parent 21958bb393
commit 4ff1046d75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

7
ggml.c
View File

@ -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);