nemo_automodel.components.models.step5.cp
nemo_automodel.components.models.step5.cp
Memory-bounded sequence transport for Step-5 context parallelism.
Module Contents
Classes
Functions
API
Bases: Function
Exchange only the preceding window and return its gradients to its owners.
Bases: Function
Gather directly into one allocation; reduce-scatter the backward gradient.
Prepend only the preceding causal window using point-to-point transport.
Parameters:
Tensor [batch, local_sequence, …], with equal contiguous CP shards.
CP process group, or None for a single rank.
Maximum number of preceding tokens, normally window - 1.
Local zero positions before the received halo, for aligning an attention tile with global key coordinates. No padding is sent.
Returns: torch.Tensor
Tensor [batch, left_padding + min(rank * local_sequence, halo_size) + local_sequence, …].
Gather non-differentiable positions, masks or indexer projections.
Parameters:
Tensor of shape [batch, local_sequence, …] without gradients.
CP group, or None for a single rank.
Returns: torch.Tensor
Tensor of shape [batch, global_sequence, …]. It aliases x without CP.
Gather contiguous sequence shards with their autograd edges.
Parameters:
Tensor of shape [batch, local_sequence, …], contiguous by CP rank.
CP group, or None for a single rank.
Returns: torch.Tensor
Tensor of shape [batch, global_sequence, …]. It aliases x without CP.