nemo_automodel.components.distributed.pipelining.autopipeline
nemo_automodel.components.distributed.pipelining.autopipeline
Module Contents
Classes
Data
API
Orchestrates pipeline-parallel training on top of torch.distributed.pipelining.
Build pipeline microbatch chunking metadata for keyword inputs.
PyTorch’s default schedule chunking splits every tensor kwarg on dim 0.
Most AutoModel batch tensors are batch-major and should keep that
default, but some model-owned input layouts place batch on another axis.
The canonical local model part can declare those exceptions by implementing
get_pipeline_kwargs_chunk_dims(kwargs) -> dict[str, int].
Parameters:
Mapping passed to the pipeline schedule. Tensor values may have arbitrary model-defined layouts; the model hook identifies any nonstandard batch axis.
Returns: dict[str, Any] | None
A chunk-spec mapping with the same nested structure as kwargs,
Build the pipeline: validate -> init meta -> split -> schedule.
Run one pipeline schedule step with model-owned input chunking.
Parameters:
Tensor of shape [batch, …] containing the first pipeline stage’s input. Ignored on ranks without the first stage.
Tensor with a model-defined target layout, or None on
ranks without the last pipeline stage.
Mutable list populated with scalar loss tensors, or None
on ranks without the last pipeline stage.
Keyword schedule inputs. Tensor values may have arbitrary model-defined layouts; model-owned metadata identifies any nonstandard batch axis.
Returns: Any
The value returned by the underlying PyTorch pipeline schedule.
Reset pipeline stage infrastructure for a new sequence length.
VLM training batches can have wildly different sequence lengths across steps (image batches vs. text-only batches). PyTorch’s PipelineStage locks in recv buffer sizes on the first step, causing a shape-mismatch error on later steps with different seq_lens.
Call this before every schedule.step() to update the stage shapes without
running an expensive forward pass. A no-op when seq_len has not changed.
Parameters:
Sequence length of the upcoming batch (input_ids.shape[1]).
Runtime state produced by pipeline-parallel setup.