nemo_automodel.components.models.deepseek_v41.cp
nemo_automodel.components.models.deepseek_v41.cp
Contiguous context parallelism for the V4.1 text backbone.
Module Contents
Functions
API
Gather rank-ordered sequence shards, summing remote uses in backward.
Parameters:
Tensor of shape [batch, local_sequence, …], with arbitrary trailing dimensions. Equal sequence lengths are required on every rank.
CP process group, or None for an identity operation.
Returns: torch.Tensor
Tensor of shape [batch, global_sequence, …]. Floating activations retain
Prepare packed boundaries once, then keep one contiguous query shard.
Parameters:
Context-parallel mesh, or None for a local packed forward.
Optional tensor-parallel mesh.
Text tensors input_ids, labels, position_ids and optional binary attention_mask [batch, global_sequence]. Packed input adds seq_lens and optional seq_lens_padded [batch, documents]. Labels must already be shifted independently within each document. Replaced in place with local tensors and document IDs [batch, local_sequence].
Optional tensor of shape [batch, global_sequence].
Input token used for padding; None uses zero. Validity comes from metadata.
LCM of this model’s active compression ratios.
Document alignment for compression groups, independent of CP size.
Synchronize the physical packed length across WORLD for HybridEP’s uniform input.
Returns: Callable
Null context factory, the local batch with runtime cp_group, and its ShardLayout.