Repository navigation
mtmd : DeepSeek-V4.1-Flash vision (deepseek41v) - #297
danielhanchen wants to merge 10 commits into
Conversation
Reuse the DeepSeek-V4-Flash-Vision ViT + 3x3 aligner graph with the V4.1 token block: [START] ([IMAGE]*w [NEWLINE])*h [END] in reading order, no lead pads, no pad row, no image_pad tensor, causal decode. Port the V4.1 resize plan (min_pixels upscale, single solve, 1024-token cap) and PIL ImageOps.pad (round half to even), and round the normalized pixels to bf16 as load_image does. Converter: DeepseekV41VisionModel writes the mmproj from the HF-style vision_config.
im2col only reads the kernel shape. The zero-stride view was non-contiguous, so CUDA rejected the op and the 3x3 unfold fell back to CPU. A contiguous view of the same shape keeps it on the GPU; outputs are byte-identical. Add the aligner shape to test-backend-ops.
…xp_probs_b_vl) Embedding (image) ubatches use ffn_exp_probs_b_vl as the expert selection bias, as DeepSeek-V4 does for mtmd input; token ubatches are unchanged.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
# Conflicts: # conversion/deepseek41.py
|
Pushed 0aa1608 (merges the #289 and #296 fixes first). The deepseek41v preprocessor now skips the bf16 rounding loop for placeholder images. Regression check over 9 image sizes: placeholder token counts now equal real-image token counts (failures 0/9; before, every placeholder errored with |
Adds DeepSeek-V4.1-Flash vision: a
deepseek41vprojector formtmd, a fix that keeps the aligner's im2col on the GPU, and the vision router bias for image tokens.Stacked on the DSpark PR (#296,
dsv41-dspark). The diff is only this change: 11 files, +259/-10.What it adds
deepseek41vprojector (tools/mtmd/):[START] ([IMAGE]*w [NEWLINE])*h [END]in reading order, with no lead pads, no pad row, noimage_padtensor, and causal decode.min_pixelsupscale, single solve, 1024-token cap) and PILImageOps.pad(round half to even), and rounds the normalized pixels to BF16 as the referenceload_imagedoes.DeepseekV41VisionModelwrites the mmproj from the HF-stylevision_config.tools/mtmd/models/deepseek4v.cpp, shared with V4): im2col only reads the kernel shape. The zero-stride view was non-contiguous, so CUDA rejected the op and the 3x3 unfold fell back to CPU. A contiguous view of the same shape keeps it on the GPU, with byte-identical outputs.test-backend-opsgets the aligner shape.ffn_exp_probs_b_vlas the expert selection bias, as DeepSeek-V4 does for mtmd input. Token ubatches are unchanged.Verification
All results are local, on B200 (CUDA
sm_100a) and x86 CPU, against the official image processor and vision model (unmodified, F32/F64).test-backend-ops -o IM2COL103/103 on CUDA.Known gaps