nemo_automodel.components.models.deepseek_v4.fsdp
nemo_automodel.components.models.deepseek_v4.fsdp
Module Contents
Classes
Functions
Data
_DSV4_RETURNED_FP32_PARAMETER_CLASS_NAMES
_DSV4_SELF_CASTING_FP32_MODULE_CLASS_NAMES
API
Bases: typing.TypedDict
Optional fully_shard arguments forwarded by fully_shard_deepseek_v4.
Return the 1D PyTorch FSDP2 group used for HCA graph alignment.
HCA graph alignment is an FSDP/FSDP2 parameter-sync invariant: ranks that synchronize the same sharded HCA parameters must agree on whether the HCA compressor path participates in backward. This DeepSeek-V4 wrapper gets that domain from its 1D PyTorch FSDP2 mesh. The mesh may be named or unnamed; multi-dimensional meshes need an explicit owner dimension to avoid reducing across unrelated parallel groups. Until that is available, disable HCA graph alignment instead of using a broader or wrong group.
Apply FSDP2 to DeepSeek-V4 without mixing fp32 and bf16 params in one unit.
This is intentionally model-specific. DeepSeek-V4 keeps a small set of reference-sensitive tensors in fp32, while the existing DeepEP path expects the transformer block itself to remain the main FSDP unit.
Uniform fp32 storage does not necessarily mean fp32 compute: full-parameter training commonly keeps fp32 master weights while the FSDP mixed-precision policy requests bf16 compute. In that case, preserve fp32 compute only for the explicitly listed reference-sensitive islands and let the parent block use the caller’s bf16 policy.
Parameters:
One module, or a list of modules sharded together as one cross-block FSDP unit under the caller’s explicit policy.
Data-parallel shard mesh.
Caller’s mixed-precision policy for the parent unit.
Optional CPU offload policy.
Remaining fully_shard options, forwarded unchanged
except that ignored_params is filtered per FP32 island.
Returns: FSDPModule | list[FSDPModule]
The sharded module, or the list of sharded modules for a group input.