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.
This commit is contained in:
Pascal authored and GitHub committed 2026-11-12 12:15:28 +01:00
1 parent 72f4603c7c
commit cfb9d4b754
1 file changed
+4
+4
View File
@@ -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:
{