fix missing non-required tensors falling back to type f32

This commit is contained in:
Ruben Ortlam 2026-03-31 09:50:59 +02:00
parent 9037b78263
commit b7870ef6b8
1 changed files with 4 additions and 0 deletions

View File

@ -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: