From d8377a0a37f314bd3713fe043b4333ad661610c1 Mon Sep 17 00:00:00 2001 From: leejet Date: Sat, 16 Aug 2025 00:46:10 +0800 Subject: [PATCH] gguf: support loading tensors which n_dims > GGML_MAX_DIMS --- ggml/include/gguf.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ggml/include/gguf.h b/ggml/include/gguf.h index 79ee202062..c603fb175a 100644 --- a/ggml/include/gguf.h +++ b/ggml/include/gguf.h @@ -76,8 +76,15 @@ extern "C" { struct ggml_context ** ctx; }; + struct gguf_tensor_shape { + int64_t ne[GGML_MAX_DIMS]; + }; + + typedef bool (*tensor_shape_read_cb_t)(const int64_t* ne, uint32_t n_dims, struct gguf_tensor_shape* shape); + GGML_API struct gguf_context * gguf_init_empty(void); GGML_API struct gguf_context * gguf_init_from_file(const char * fname, struct gguf_init_params params); + GGML_API struct gguf_context * gguf_init_from_file_ext(const char * fname, struct gguf_init_params params, tensor_shape_read_cb_t on_tensor_shape_read); //GGML_API struct gguf_context * gguf_init_from_buffer(..); GGML_API void gguf_free(struct gguf_context * ctx);