nemo_automodel.components.models.ergo.context_parallel
nemo_automodel.components.models.ergo.context_parallel
Ergo document-preserving batch preparation over the shared CP sharder.
Module Contents
Functions
API
Keep IDs global for embedding, and shard auxiliaries in contiguous order.
Parameters:
Stage-local context mesh. Peers receive the same full batch.
Unused TP mesh passed to the shared sharder.
Global IDs, labels, positions, masks [batch, sequence]. The attention mask contains document IDs (zero means padding); positions must be supplied for packed documents. Entries are replaced in place, but input tensor storage is never modified. Native THD is unsupported.
Optional global supervision weights [batch, sequence].
Sentinel passed to shared padding machinery.
Returns: Callable[[], contextlib.AbstractContextManager]
Null context factory, prepared batch, and contiguous shard layout.
Keep packed stage-zero IDs global while TE owns the token partition.
Parameters:
This pipeline stage’s context mesh; None means CP1.
Unused TP mesh from the shared sharder contract.
IDs, labels and positions [batch, sequence], real/padded document lengths [batch, documents], and optional loss weights of the ID shape. Tensor storage is retained unchanged; the returned mapping is new.
Number of PP microbatches, evenly dividing the batch dimension.
Optional supervision weights [batch, sequence].
Filler passed to the shared TE preparation.
Returns: Callable[[], contextlib.AbstractContextManager]
Null context, prepared mapping and single-chunk layout (None for multiple