From d89533dff60c758cc59401e5e260855c540008a3 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 27 Jul 2023 11:10:34 +0300 Subject: [PATCH] gguf : expose the gguf_type enum through the API for now --- examples/gguf/gguf.cpp | 13 ------------- ggml.c | 13 ------------- ggml.h | 14 ++++++++++++++ 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/examples/gguf/gguf.cpp b/examples/gguf/gguf.cpp index a5c442ac5..d6a0691d0 100644 --- a/examples/gguf/gguf.cpp +++ b/examples/gguf/gguf.cpp @@ -7,19 +7,6 @@ #include #include -enum gguf_type { - GGUF_TYPE_UINT8 = 0, - GGUF_TYPE_INT8 = 1, - GGUF_TYPE_UINT16 = 2, - GGUF_TYPE_INT16 = 3, - GGUF_TYPE_UINT32 = 4, - GGUF_TYPE_INT32 = 5, - GGUF_TYPE_FLOAT32 = 6, - GGUF_TYPE_BOOL = 7, - GGUF_TYPE_STRING = 8, - GGUF_TYPE_ARRAY = 9, -}; - template static std::string to_string(const T & val) { std::stringstream ss; diff --git a/ggml.c b/ggml.c index b005fd889..ebdb6536f 100644 --- a/ggml.c +++ b/ggml.c @@ -18297,19 +18297,6 @@ size_t ggml_quantize_chunk(enum ggml_type type, const float * src, void * dst, i //////////////////////////////////////////////////////////////////////////////// -enum gguf_type { - GGUF_TYPE_UINT8 = 0, - GGUF_TYPE_INT8 = 1, - GGUF_TYPE_UINT16 = 2, - GGUF_TYPE_INT16 = 3, - GGUF_TYPE_UINT32 = 4, - GGUF_TYPE_INT32 = 5, - GGUF_TYPE_FLOAT32 = 6, - GGUF_TYPE_BOOL = 7, - GGUF_TYPE_STRING = 8, - GGUF_TYPE_ARRAY = 9, -}; - struct gguf_str { uint32_t n; char * data; diff --git a/ggml.h b/ggml.h index e0abbbfdd..91588895c 100644 --- a/ggml.h +++ b/ggml.h @@ -1619,6 +1619,20 @@ extern "C" { // gguf // + // TODO: can be removed if the API is extended for writing + enum gguf_type { + GGUF_TYPE_UINT8 = 0, + GGUF_TYPE_INT8 = 1, + GGUF_TYPE_UINT16 = 2, + GGUF_TYPE_INT16 = 3, + GGUF_TYPE_UINT32 = 4, + GGUF_TYPE_INT32 = 5, + GGUF_TYPE_FLOAT32 = 6, + GGUF_TYPE_BOOL = 7, + GGUF_TYPE_STRING = 8, + GGUF_TYPE_ARRAY = 9, + }; + struct gguf_context; struct gguf_init_params {