From 5114672c482012d77d24bbd09eae86b53c48256b Mon Sep 17 00:00:00 2001 From: fszontagh <51741446+fszontagh@users.noreply.github.com> Date: Thu, 23 Jul 2026 16:22:21 +0200 Subject: [PATCH] fix: detect vision patch size for unsplit (HF-format) Qwen3-VL (#1811) --- src/model/te/llm.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/model/te/llm.hpp b/src/model/te/llm.hpp index e5c521ef..60e2d9c1 100644 --- a/src/model/te/llm.hpp +++ b/src/model/te/llm.hpp @@ -200,7 +200,11 @@ namespace LLM { config.vision.in_channels = tensor_storage.ne[2]; config.vision.hidden_size = tensor_storage.ne[3]; } - if (contains(name, "visual.patch_embed.bias")) { + // HF-format checkpoints keep the patch embed unsplit under a single name. + if (contains(name, "visual.patch_embed.proj.weight")) { + config.vision.patch_size = static_cast(tensor_storage.ne[0]); + } + if (contains(name, "visual.patch_embed.bias") || contains(name, "visual.patch_embed.proj.bias")) { config.vision.hidden_size = tensor_storage.ne[0]; } if (contains(name, "visual.pos_embed.weight")) {