Commit cfb9d4b75 for llama.cpp
commit cfb9d4b754616ca47d165fa1ff8a7a80c30847e3
Author: Pascal <admin@serveurperso.com>
Date: Thu Nov 12 12:15:28 2026 +0100
mtmd: require an F32 position embedding for HunyuanVL (#32131)
HunyuanVL resamples its position embedding on the host into a float
buffer sized for F32, then reads ggml_nbytes() of the tensor into it.
The graph never uses the tensor, so any type loads, and an F64 tensor
overflows the buffer at the first image request.
Require the position embedding to be present and F32 when loading the
HunyuanVL tensors.
diff --git a/tools/mtmd/mtmd-model.cpp b/tools/mtmd/mtmd-model.cpp
index b6727a493..da74ed383 100644
--- a/tools/mtmd/mtmd-model.cpp
+++ b/tools/mtmd/mtmd-model.cpp
@@ -3000,6 +3000,10 @@ struct mtmd_model_loader {
model.mm_img_end = get_tensor(TN_MM_IMG_END);
model.image_newline = get_tensor(TN_IMAGE_NEWLINE);
model.view_seperator = get_tensor(TN_IMAGE_SEPERATOR, false);
+ // the position embedding is resampled on the host as F32
+ if (!model.position_embeddings || model.position_embeddings->type != GGML_TYPE_F32) {
+ throw std::runtime_error(mtmd_format("%s: HunyuanVL requires an F32 %s\n", __func__, mtmd_format(TN_POS_EMBD, prefix).c_str()));
+ }
} break;
case PROJECTOR_TYPE_JANUS_PRO:
{