Add DeepSeek 3.2 support#1264
Open
michaelroyzen wants to merge 2 commits into
Open
Conversation
Contributor
Author
|
Hi @Tcc0403 @Mecoli1219 can I get a review please? |
Tcc0403
approved these changes
Jul 8, 2026
Tcc0403
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, cc @Mecoli1219 @vaibhavjindal for ci check
Contributor
Author
|
Hi @Mecoli1219, can we merge please? |
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.
Summary
Adds Liger Kernel support for Hugging Face Transformers
deepseek_v32/ DeepSeek-V3.2.DeepseekV32ForCausalLM.apply_liger_kernel_to_deepseek_v32into public exports and model-type autodispatch.Implementation Notes
DeepSeek-V3.2 uses custom attention machinery in Transformers:
_supports_sdpa = True_supports_flash_attn = FalseThis PR therefore validates Liger support with
attn_implementation="sdpa"and does not attempt to patch or replace the model's sparse attention path. FlashAttention 2 is not advertised as supported by the Transformers model implementation.RoPE is intentionally not patched. DeepSeek-V3.2 uses interleaved partial RoPE in the main MLA path and a separate non-interleaved RoPE path for the DSA indexer, which is not compatible with Liger's generic RoPE swap.
For SwiGLU, sparse MoE routed experts are left on the upstream packed expert implementation. Liger patches the dense MLP layers and sparse-layer
shared_experts, reusing the existing Qwen3 MoE-compatible SwiGLU wrapper to avoid introducing a duplicate DeepSeek-specific helper.Validation
Validated on H200 with CUDA 13 nightly PyTorch:
torch 2.14.0.dev20260619+cu130torchvision 0.29.0.dev20260620+cu130torch.version.cuda == 13.0The CUDA/cuDNN wheel library directories were prepended to
LD_LIBRARY_PATHfor SDPA:Passing checks:
Convergence results:
The fp32 FLCE eval loss matched exactly in the latest run (
9.922870635986328reference and Liger). The bf16 FLCE eval loss differed by approximately1.1e-5, within tolerance.