From 5d10eaac8d14c23b71fda31851ac420458c8c811 Mon Sep 17 00:00:00 2001 From: Juarez Bochi Date: Wed, 3 Jan 2024 16:33:47 -0500 Subject: [PATCH] Add tensor type features for int types --- gguflib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gguflib.c b/gguflib.c index 30a2fba..18678b9 100644 --- a/gguflib.c +++ b/gguflib.c @@ -43,6 +43,9 @@ struct gguf_tensor_type_features { {"q5_k", 256, 176}, {"q6_k", 256, 210}, {"q8_k", 256, 292}, + {"i8", 1, 1}, + {"i16", 1, 2}, + {"i32", 1, 4}, }; /* Return the value type name given the type ID. */ @@ -270,6 +273,7 @@ int gguf_get_tensor(gguf_ctx *ctx, gguf_tensor *tensor) { } } uint32_t *type = (uint32_t*) (ctx->data+ctx->off); + if (*type >= GGUF_TYPE_COUNT) return 0; ctx->off += 4; // Skip tensor type. tensor->type = *type;