From 37964f44f9fab37571b27cccd9f45d4a066e0817 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 26 Feb 2026 18:39:49 +0200 Subject: [PATCH] mtmd : fix padding of n_tokens (#19930) --- tools/mtmd/mtmd-helper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mtmd/mtmd-helper.cpp b/tools/mtmd/mtmd-helper.cpp index 902a4b456d..c75f90730f 100644 --- a/tools/mtmd/mtmd-helper.cpp +++ b/tools/mtmd/mtmd-helper.cpp @@ -248,7 +248,7 @@ int32_t mtmd_helper_decode_image_chunk( int32_t n_tokens = mtmd_input_chunk_get_n_tokens(chunk); int32_t i_batch = 0; - int32_t n_img_batches = GGML_PAD(n_tokens, n_batch) / n_batch; + int32_t n_img_batches = (n_tokens + n_batch - 1) / n_batch; decode_embd_batch batch_embd(encoded_embd, n_tokens, n_pos_per_embd, n_mmproj_embd); if (mtmd_decode_use_mrope(ctx)) {