mtmd: deepseek-ocr v1 multi-tile#24717
Conversation
…reprocessors for both versions (ds-ocr v1 and v2)
There was a problem hiding this comment.
@sfallah I'm targeting to make this version works with only one row of tiles per batch (fused into one input image_f32: w = tile_size and h = tile_size * n_col)
then later on, we can simply flip support_batch() to true to allow multi-row batching
for now, shapes are matching but this output gibberish, appreciate if you can help debugging which part is wrong. I added extensive debugging logs, but they will be removed once we found the problem
Two bugs: 1. Gibberish — if (pos != MTMD_POS_TYPE_MROPE) {
return nx * ny; // nx already holds the total
}2. v2 multi-column crash — the shared row-fusion makes a tall image that only the v1 graph re-splits; v2 feeds it straight to SAM and trips the const bool fuse_row = clip_get_projector_type(ctx) == PROJECTOR_TYPE_DEEPSEEKOCR;Verified bf16 / flash-off — v1 & v2 both pass single / (1,2) / (2,3); |
|
hi @ngxson |
|
Thanks for the investigation. The problem with n_tokens() counting is fixed with a different approach, see: #24732 I updated the preprocessor code as you suggested and it's working correctly. Can you confirm if this passes the tests now? Test results on my side: |
|
no, sadly something is wrong.
Result: FAILThe CER score on master 0.2256. |
|
hmm ok I spot some problems regarding handling overview image for all llava-uhd models I'm pushing a refactoring on that part, will tag you for for testing |
|
@sfallah Ok so I narrowed down the potentially regressions, it seems like there are two potential problems:
I verified that the small input image ( Can you isolate your changes and try to find the root cause? |
|
@ngxson |
There was a problem hiding this comment.
| "-p", "Free OCR.", |
With this small change it will also pass the regression test for ds-ocr v1.
@ngxson
I had also a closer look at the output it is fine.
There was a problem hiding this comment.
seems like it's removed on master, so should be good after my last rebase commit - please give it a try
|
Opened #25481 with a few fixes for this branch. |
* ds-ocr img-preproc fuse_row tile-drop fix for multi rows and columns images * mtmd drop the duplicate redundant img_end * deepseekocr graph simplify CLS broadcast cleanup
|
Opened #25486 with test fixes for this branch. |
…pt space; make DRY opt-in and n_predict model-specific (#25486)

Overview
Supersede #24647
Ref discussion: #24647 (comment)
Requirements