Repository navigation
feat: support DeepSeek V4 Flash Vision - #3772
Conversation
Signed-off-by: HuiyingLi <willwin.lee@gmail.com>
Signed-off-by: HuiyingLi <willwin.lee@gmail.com>
Signed-off-by: HuiyingLi <willwin.lee@gmail.com>
Signed-off-by: HuiyingLi <willwin.lee@gmail.com>
|
/claude review |
|
Reviewed the DeepSeek-V4-Flash-Vision-Exp onboarding (16 files;
One minor tensor-contract nit left inline (missing layout docstring for the new |
| vanilla_key_len: int | None = None, | ||
| q_positions: torch.Tensor | None = None, | ||
| vision_token_types: torch.Tensor | None = None, | ||
| max_image_tokens: int = 0, |
There was a problem hiding this comment.
This signature was materially changed to accept a new tensor input vision_token_types, but the one-line docstring doesn't document its layout. The body validates vision_token_types.shape == (batch_size, seq_len), so the contract should be stated. Suggest expanding to a Google-style Args section, e.g.:
vision_token_types: Optional pseudo-token types of shape [batch, sequence]
(`-1` at text positions, `IMAGE_START`/`IMAGE`/`IMAGE_END` etc. inside
image spans). When provided with `max_image_tokens > 0`, image queries
additionally see the full image span; ignored otherwise.
max_image_tokens: Maximum tokens per image span; `0` disables visual windowing.
Document the batch/sequence layout and visual-window behavior for the new vision token type input. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: HuiyingLi <willwin.lee@gmail.com>
|
/claude review |
|
LGTM Reviewed all 16 changed files (uv.lock excluded). This adds the DeepSeek-V4-Flash-Vision tower, aligner, visual MoE gate, image-visibility masking, sparse visual attention windowing, processor, PP media staging, state-dict mapping, and parity tooling. Verified against the trusted base:
|
|
/ok to test fd0b017 |
What does this PR do ?
Add native AutoModel support for
deepseek-ai/DeepSeek-V4-Flash-Vision-Exp, including the released vision tower/aligner, dynamic-resolution processor, image-token bridge, visual attention visibility, vision-aware MoE routing, checkpoint conversion, FSDP/PP integration, and MedPix validation recipes.Changelog
bias_vlwhile preserving text hash routing in the early DSV4 layers.Validation
Vision-only released-implementation parity
This parity compares only the 32-layer vision encoder, aligner, visual N-layout, and permutation using the released checkpoint implementation and the same real checkpoint weights.
Slurm job
17526208:COMPLETED, exit0:0, 1 GPU, 41 seconds.Focused tests
python -m pytest -q tests/unit_tests/models/deepseek_v4/test_dsv4_vision.py60 passedon one H100.Distributed training validation
17527387:COMPLETED 0:0; 8 GPUs; full 32-layer vision tower; 4 language layers; 4K sequence; EP4/PP2; HybridEP + TileLang + torch-mm experts; activation checkpointing; two backward/optimizer steps.17529267:COMPLETED 0:0; 8 nodes / 64 GPUs; 4K sequence; EP32; two backward/optimizer steps.17529854:COMPLETED 0:0; 16 nodes / 128 GPUs; full model; 4K sequence; EP32/PP4; HybridEP + TileLang + torch-mm experts; activation checkpointing; 100 steps.Final 100-step run: Weights & Biases
mmoukouba/MedPix-VQA, train split2.2812at step 0 to1.4531at step 992.12265; last 10 steps1.4203111.19 s/step3273.26 tokens/s(102.29 tokens/sper EP/data-parallel GPU)63.89 GiBExisting DSV4 CP/Tulu-3 regression
The existing text-only DeepSeek-V4 Flash training path was validated on the exact PR head with the NeMo-CI nightly image. No DSV4 CP/Tulu-3 regression was observed.
successsuccess; Slurm5956453,COMPLETED, exit0:09cbdddc1dbbeeaeb6a7a1e15ca50d36cc1a9cab7, runtime-mounted overnvcr.io/nvidian/nemo-automodel:nightly; no container rebuildallenai/tulu-3-sft-mixture, train split; 16K sequence;max_lengthpadding; unpacked; global batch 256 / local batch 41.1989, 1.1164, 0.9533, 0.7001, 0.7561, 0.8824, 0.9414, 0.6268, 0.6302, 0.762835.49 GiB/GPUBefore your PR is "Ready for review"
Pre checks:
Additional Information
num_nextn_predict_layers: 0.