Skip to content

Commit 760cfaa

Browse files
authored
fix: ignore tensors with the particular dim while loading (#233)
1 parent 6d16f68 commit 760cfaa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

model.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,11 @@ bool ModelLoader::init_from_safetensors_file(const std::string& file_path, const
888888
}
889889
}
890890

891+
// ggml/src/ggml.c:2745
892+
if (n_dims < 1 || n_dims > GGML_MAX_DIMS) {
893+
continue;
894+
}
895+
891896
TensorStorage tensor_storage(prefix + name, type, ne, n_dims, file_index, ST_HEADER_SIZE_LEN + header_size_ + begin);
892897
tensor_storage.reverse_ne();
893898

0 commit comments

Comments
 (0)