From b7870ef6b824bb21b74e496a0f22319c2672fefb Mon Sep 17 00:00:00 2001 From: Ruben Ortlam Date: Tue, 31 Mar 2026 09:50:59 +0200 Subject: [PATCH] fix missing non-required tensors falling back to type f32 --- src/llama-model-loader.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/llama-model-loader.cpp b/src/llama-model-loader.cpp index 3d549cae5b..9dbc108036 100644 --- a/src/llama-model-loader.cpp +++ b/src/llama-model-loader.cpp @@ -1215,6 +1215,10 @@ struct ggml_tensor * llama_model_loader::create_tensor( const int64_t tid = gguf_find_tensor(metadata, tn.str().c_str()); if (tid != -1) { type = gguf_get_tensor_type(metadata, tid); + } else if (flags & TENSOR_NOT_REQUIRED) { + // If the tensor is not found and not required, return nullptr to allow + // the caller to fall back + return nullptr; } // for tensors that are not required some of the dimensions can be invalid: