10000 mtmd-helper : bug fix to token batching in mtmd by l3utterfly · Pull Request #13650 · ggml-org/llama.cpp · GitHub
[go: up one dir, main page]

Skip to content

mtmd-helper : bug fix to token batching in mtmd #13650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 20, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update tools/mtmd/mtmd-helper.cpp
Co-authored-by: Xuan-Son Nguyen <thichthat@gmail.com>
  • Loading branch information
l3utterfly and ngxson authored May 20, 2025
commit 06a5b04033d27431bbed410c95c4672b946c43cc
11 changes: 6 additions & 5 deletions tools/mtmd/mtmd-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,12 @@ int32_t mtmd_helper_eval_chunk_single(mtmd_context * ctx,
while (i < n_tokens) { // split into batches
text_batch.n_tokens = 0; // clear the batch
for (; i < n_tokens && text_batch.n_tokens < n_batch; i++) {
text_batch.token [text_batch.n_tokens] = tokens[i];
text_batch.pos [text_batch.n_tokens] = n_past++;
text_batch.n_seq_id[text_batch.n_tokens] = 1;
text_batch.seq_id [text_batch.n_tokens][0] = seq_id;
text_batch.logits [text_batch.n_tokens] = false;
int32_t j = text_batch.n_tokens;
text_batch.token [j] = tokens[i];
text_batch.pos [j] = n_past++;
text_batch.n_seq_id[j] = 1;
text_batch.seq_id [j][0] = seq_id;
text_batch.logits [j] = false;

text_batch.n_tokens++;
}
Expand Down
0