mtmd: add GLM-5.2-Vision (#26126)

Co-authored-by: Eric Hartford <eric@quixi.ai>
This commit is contained in:
Eric Hartford
2026-07-26 20:43:51 +02:00
committed by GitHub
co-authored by Eric Hartford
parent b1d4c65524
commit af285020e9
3 changed files with 28 additions and 3 deletions
+11 -3
View File
@@ -555,9 +555,17 @@ struct mtmd_context {
} break;
case PROJECTOR_TYPE_KIMIK25:
{
// <|media_begin|> ... (image embeddings) ... <|media_end|>
img_beg = "<|media_begin|>";
img_end = "<|media_end|>";
// GLM-5.2-V reuses the Kimi-K2.5 vision encoder and projector, but marks
// images with its own tokens, so decide based on the text model vocab
if (lookup_token("<|begin_of_image|>") != LLAMA_TOKEN_NULL) {
// <|begin_of_image|> ... (image embeddings) ... <|end_of_image|>
img_beg = "<|begin_of_image|>";
img_end = "<|end_of_image|>";
} else {
// <|media_begin|> ... (image embeddings) ... <|media_end|>
img_beg = "<|media_begin|>";
img_end = "<|media_end|>";
}
image_preproc = std::make_unique<mtmd_image_preprocessor_dyn_size>(ctx_v);
} break;
case PROJECTOR_TYPE_LIGHTONOCR: