fix: ignore tensors with the particular dim while loading (#233)

This commit is contained in:
Eugene 2024-04-29 20:04:27 +05:00 committed by GitHub
parent 6d16f6853e
commit 760cfaa618
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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();