Skip to content

Support Dpsk4.1 SFT and RL - #10179

Open
tastelikefeet wants to merge 9 commits into
modelscope:mainfrom
tastelikefeet:feat/deepseek-v41
Open

tastelikefeet wants to merge 9 commits into
modelscope:mainfrom
tastelikefeet:feat/deepseek-v41

Conversation

@tastelikefeet

Copy link
Copy Markdown
Collaborator

PR type

  • Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

Write the detail information belongs to this PR.

Experiment results

Paste your experiment result here(if needed).

- Register deepseek_v41 model type (LLM + MLLM) and model arch (vision/aligner)
- Add V4.1 config classes (text/vision composite) and vLLM compat patches
  (hc_head init, deep_gemm bundled swap, bf16 o_proj fallback, weight skip)
- Add template support for V4.1 (multimodal)
- Megatron: engram freezing for on-policy GRPO, RL weight-sync skips
  unsupported engram export
- Add GRPO colocate examples (full + lora) and V4.1 template align test
- Add FSDP sharded LoRA conversion util
LoRA SFT and colocate GRPO starting points for DeepSeek-V4.1-Flash. Both record the
parallelism support boundary (CP/PP/EP/DP/VPP work, training TP and SP do not), why
--bf16 must stay, and that vLLM TP for rollout is unrelated to the unsupported training
TP. The GRPO script also notes that LoRA weight sync ships adapters only, so the Engram
tables stay resident in the rollout engine.
…rsions in the examples

DeepSeek-V4.1 does not run on any released megatron-core wheel: it needs the hybrid stack,
Engram and CSA2 code, so both example scripts now spell out the source checkout that was
validated -- the dev branch with NVIDIA/Megatron-LM PR modelscope#7224 merged in -- and say to expose
it through PYTHONPATH so it shadows an installed megatron-core.

Same for the two Python packages: ms-swift and mcore-bridge both need source installs,
because v4.1 support landed after their latest releases and requirements/megatron.txt still
pins mcore-bridge >= 1.6.3, which predates it.
…ted TP/SP, document CP recipe)

The two colocate GRPO examples set --tensor_model_parallel_size 8 and
--sequence_parallel true (to satisfy AbsorbedMLA's "SP required when TP>1"
guard), but TP/SP are not a validated path for DeepSeek-V4.1 (TP is design-doc
only; SP depends on TP). This contradicts the support matrix already documented
in the models/ SFT+GRPO examples. Set TP=1 and drop --sequence_parallel so all
four examples agree with the validated CP/PP/EP/DP/VPP support set. EP=8/PP=4
now matches examples/models/deepseek_v41/megatron_grpo.sh.

Also document the non-obvious context-parallel recipe in all four examples: a
naive --context_parallel_size>1 fails because DSv4's hybrid attention
(CSA2/Engram) rejects the default zigzag CP layout and contiguous CP needs THD
(packed) inputs from a sequence-packing scheduler. The correct combo is:
  --cp_partition_mode contiguous --packing true --sequence_packing_scheduler default_dynamic_cp

No code change; comments and flag values only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant