Skip to content

Conversation

@l3utterfly
Copy link
Contributor

From my understanding, we should be setting each field in the tokens batch using the current text_batch.n_tokens counter, instead of the outer i counter.

If the outer n_tokens > n_batch, the original code gives a segmentation fault because each batch is only initialised with n_batch number of spaces, but i will increase to the number of overall n_tokens.

Copy link
Collaborator

@ngxson ngxson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah thanks for noticing, I think I mistakenly left the i variable there from the non-batching code

@ngxson ngxson changed the title bug fix to token batching in mtmd mtmd-helper : bug fix to token batching in mtmd May 20, 2025
Co-authored-by: Xuan-Son Nguyen <[email protected]>
@ngxson ngxson merged commit b7a1746 into ggml-org:master May 20, 2025
83 of 86 checks passed
infil00p pushed a commit to baseweight/llama.cpp that referenced this pull request May 22, 2025
* Update mtmd-helper.cpp

* Update tools/mtmd/mtmd-helper.cpp

Co-authored-by: Xuan-Son Nguyen <[email protected]>

---------

Co-authored-by: Xuan-Son Nguyen <[email protected]>
@l3utterfly l3utterfly deleted the patch-1 branch May 23, 2025 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants