From 5537ec4bdc7f5c1e21e8701fefd3f50891d15b2b Mon Sep 17 00:00:00 2001 From: Wagner Bruna Date: Thu, 28 May 2026 23:43:59 -0300 Subject: [PATCH] fix: explicitly exclude f8, f64 and i64 tensors from mmap In these cases, tensor_storage.type is not the type from the file, so the tensors could end up memory-mapped, incorrectly skipping the necessary type conversion. --- src/model.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/model.cpp b/src/model.cpp index 25d78b94e..89d08a7a0 100644 --- a/src/model.cpp +++ b/src/model.cpp @@ -865,8 +865,13 @@ std::vector ModelLoader::mmap_tensors(std::maptype) + if (tensor_storage.is_f8_e4m3 || + tensor_storage.is_f8_e5m2 || + tensor_storage.is_f64 || + tensor_storage.is_i64 || + tensor_storage.type != dst_tensor->type) { continue; + } size_t tensor_size = tensor_storage.nbytes(); size_t tensor_offset = tensor_storage.offset;