Skip to content

Commit d8377a0

Browse files
committed
gguf: support loading tensors which n_dims > GGML_MAX_DIMS
1 parent dd745ba commit d8377a0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ggml/include/gguf.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,15 @@ extern "C" {
7676
struct ggml_context ** ctx;
7777
};
7878

79+
struct gguf_tensor_shape {
80+
int64_t ne[GGML_MAX_DIMS];
81+
};
82+
83+
typedef bool (*tensor_shape_read_cb_t)(const int64_t* ne, uint32_t n_dims, struct gguf_tensor_shape* shape);
84+
7985
GGML_API struct gguf_context * gguf_init_empty(void);
8086
GGML_API struct gguf_context * gguf_init_from_file(const char * fname, struct gguf_init_params params);
87+
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);
8188
//GGML_API struct gguf_context * gguf_init_from_buffer(..);
8289

8390
GGML_API void gguf_free(struct gguf_context * ctx);

0 commit comments

Comments
 (0)