8000 mtmd-helper : bug fix to token batching in mtmd (#13650) · robbiemu/llama.cpp@b7a1746 · GitHub
[go: up one dir, main page]

Skip to content

Commit b7a1746

Browse files
l3utterflyngxson
andauthored
mtmd-helper : bug fix to token batching in mtmd (ggml-org#13650)
* Update mtmd-helper.cpp * Update tools/mtmd/mtmd-helper.cpp Co-authored-by: Xuan-Son Nguyen <thichthat@gmail.com> --------- Co-authored-by: Xuan-Son Nguyen <thichthat@gmail.com>
1 parent be02396 commit b7a1746

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tools/mtmd/mtmd-helper.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,14 @@ int32_t mtmd_helper_eval_chunk_single(mtmd_context * ctx,
231231
while (i < n_tokens) { // split into batches
232232
text_batch.n_tokens = 0; // clear the batch
233233
for (; i < n_tokens && text_batch.n_tokens < n_batch; i++) {
234+
int32_t j = text_batch.n_tokens;
235+
text_batch.token [j] = tokens[i];
236+
text_batch.pos [j] = n_past++;
237+
text_batch.n_seq_id[j] = 1;
238+
text_batch.seq_id [j][0] = seq_id;
239+
text_batch.logits [j] = false;
240+
234241
text_batch.n_tokens++;
235-
text_batch.token [i] = tokens[i];
236-
text_batch.pos [i] = n_past++;
237-
text_batch.n_seq_id[i] = 1;
238-
text_batch.seq_id [i][0] = seq_id;
239-
text_batch.logits [i] = false;
240242
}
241243
bool is_last_token = (i == n_tokens);
242244
if (logits_last && is_last_token) {

0 commit comments

Comments
 (0)
0