From 760cfaa61896a02dab8b1ac84a59b17ddf951090 Mon Sep 17 00:00:00 2001 From: Eugene <130867375+ring-c@users.noreply.github.com> Date: Mon, 29 Apr 2024 20:04:27 +0500 Subject: [PATCH] fix: ignore tensors with the particular dim while loading (#233) --- model.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/model.cpp b/model.cpp index c8cc5e3..3db919b 100644 --- a/model.cpp +++ b/model.cpp @@ -888,6 +888,11 @@ bool ModelLoader::init_from_safetensors_file(const std::string& file_path, const } } + // ggml/src/ggml.c:2745 + if (n_dims < 1 || n_dims > GGML_MAX_DIMS) { + continue; + } + TensorStorage tensor_storage(prefix + name, type, ne, n_dims, file_index, ST_HEADER_SIZE_LEN + header_size_ + begin); tensor_storage.reverse_ne();