We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f0ba3d commit 7e3471cCopy full SHA for 7e3471c
mlx/io/gguf.cpp
@@ -57,9 +57,15 @@ Shape get_shape(const gguf_tensor& tensor) {
57
}
58
59
std::tuple<allocator::Buffer, Dtype> extract_tensor_data(gguf_tensor* tensor) {
60
+ if (tensor == nullptr) {
61
+ throw std::invalid_argument("[extract_tensor_data] Input tensor pointer is null.");
62
+ }
63
std::optional<Dtype> equivalent_dtype = gguf_type_to_dtype(tensor->type);
64
// If there's an equivalent type, we can simply copy.
65
if (equivalent_dtype.has_value()) {
66
+ if (tensor->weights_data == nullptr) {
67
+ throw std::runtime_error("[load_gguf] NULL tensor data pointer");
68
69
allocator::Buffer buffer = allocator::malloc(tensor->bsize);
70
memcpy(
71
buffer.raw_ptr(),
0 commit comments