deepseek-ocr SAM ggml_conv_2d with the im2col kept in F32 - #26727
Open
sfallah wants to merge 1 commit into
Open
Conversation
ngxson
reviewed
Aug 7, 2026
| } | ||
|
|
||
| // ggml_conv_2d with the im2col kept in F32: the F16 im2col it emits since #23660 degrades OCR | ||
| static ggml_tensor * conv_2d_f32(ggml_context * ctx0, ggml_tensor * a, ggml_tensor * b, |
Collaborator
There was a problem hiding this comment.
if we simply cast the kernel to F32 and run ggml_conv_2d, does it work?
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.
Description
Since #23660, ggml_conv_2d emits an F16 im2col for all non-F16 conv kernels. The SAM convs in DeepSeek-OCR run F32 weights, and the F16 im2col measurably degrades their OCR quality on CUDA. This PR keeps the im2col of these convs in F32, in the model code. On Metal the output is unchanged.
DeepSeek-OCR eval on CUDA (DGX Spark), single-view scan, this branch vs master:
Requirements