From edfb440a2f469ea3abaf397627bdc7d40b7777d8 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 28 Mar 2026 16:27:36 +0200 Subject: [PATCH] server : fix processing of multiple back-to-back mtmd chunks (#21107) --- tools/server/server-context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/server/server-context.cpp b/tools/server/server-context.cpp index b79a5270b5..6f737d94d0 100644 --- a/tools/server/server-context.cpp +++ b/tools/server/server-context.cpp @@ -2493,7 +2493,7 @@ private: bool has_mtmd = false; // check if we should process the image - if (slot.prompt.n_tokens() < slot.task->n_tokens() && input_tokens[slot.prompt.n_tokens()] == LLAMA_TOKEN_NULL) { + while (slot.prompt.n_tokens() < slot.task->n_tokens() && input_tokens[slot.prompt.n_tokens()] == LLAMA_TOKEN_NULL) { // process the image size_t n_tokens_out = 0; int32_t res = input_tokens.process_chunk(ctx, mctx, slot.prompt.n_tokens(), slot.prompt.tokens.pos_next(), slot.id, n_tokens_out);