Repository navigation
FIX: mtmd_tokenize: error - #2360
Merged
Merged
Conversation
DEEPSEEK4 SLOP Explanation. (Tested and is working correctly after build) fix mtmd: missing text_len in gpttype_adapter.cpp aggregate init Commit 4114ba1 ("mtmd: fix silent prompt truncation on embedded NUL (ggml-org#25548)") added a `text_len` field to `mtmd_input_text`, changing the struct layout from: { text, add_special, parse_special } to: { text, text_len, add_special, parse_special } The aggregate initialization in `gpttype_adapter.cpp` was never updated to account for the new field. With C++ aggregate init, the positional arguments shifted: mtmd_input_text inp_txt = { mtmd_default_marker(), // text = "<__media__>" /* add_special */ false, // text_len = 0 <-- BUG /* parse_special */ true, // add_special = true }; // parse_special is zero-initialized Because text_len was 0, `input_text.assign(text->text, text->text_len)` in the mtmd_tokenizer constructor produced an empty string. `split_text()` on an empty string returned an empty vector, yielding zero media markers in the text -- but one bitmap was still provided, triggering the error: mtmd_tokenize: error: number of media markers in text (0) does not match number of bitmaps (1) Fix by explicitly capturing the marker pointer and passing its length.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DEEPSEEK4 SLOP Explanation. (Tested and is working correctly after build)
fix mtmd: missing text_len in gpttype_adapter.cpp aggregate init
Commit 4114ba1 ("mtmd: fix silent prompt truncation on embedded NUL (ggml-org#25548)") added a
text_lenfield tomtmd_input_text, changing the struct layout from:to:
The aggregate initialization in
gpttype_adapter.cppwas never updated to account for the new field. With C++ aggregate init, the positional arguments shifted:Because text_len was 0,
input_text.assign(text->text, text->text_len)in the mtmd_tokenizer constructor produced an empty string.split_text()on an empty string returned an empty vector, yielding zero media markers in the text -- but one bitmap was still provided, triggering the error:Fix by explicitly capturing the marker pointer and passing its length.