nemo_automodel.components.distributed.pipelining.config
nemo_automodel.components.distributed.pipelining.config
Pipeline parallel configuration class.
Design principle:
- Device mesh (world_mesh, moe_mesh) is passed separately to from_pretrained/from_config
- PipelineConfig contains scheduling, splitting, and runtime options
- loss_fn is included here since it’s only used for pipelining
- Axis names are inferred automatically from device_mesh in _instantiate_pipeline
Usage: from nemo_automodel.components.distributed.pipelining.config import PipelineConfig
config = PipelineConfig( pp_schedule=“1f1b”, pp_microbatch_size=2, pp_batch_size=8, loss_fn=my_loss_fn, )
Module Contents
Classes
API
Configuration for pipeline parallel training.
Note: Device mesh (world_mesh, moe_mesh) is passed separately on the from_pretrained/from_config method signature. Pipeline parallelism is enabled when pp_size > 1. Axis names are inferred automatically from the device mesh structure.
Data type for pipeline computation. If None, uses the model’s default dtype.
Number of transformer layers per pipeline stage. If None, layers are split evenly across stages.
Loss function used for pipeline training. Required when pipeline is enabled. The function signature should be compatible with the model’s output format.
Explicit specification of which module FQNs belong to each model part/stage. If provided, overrides automatic layer splitting.
Apply pipeline patches to the CausalLM wrapper model. Defaults to True.
Apply pipeline patches to the inner model (e.g., the base transformer in a CausalLM wrapper). Defaults to True.
Patch stage backward to use no_sync context for gradient accumulation efficiency. Useful when combining PP with FSDP.
Total batch size per pipeline stage. Must be divisible by pp_microbatch_size.
Size of each microbatch for pipeline execution. pp_batch_size must be divisible by pp_microbatch_size.
Pool the per-microbatch P2P recv buffers into a ring sized to the 1F1B in-flight depth instead of pre-allocating one buffer set per microbatch and direction. Cuts pipeline-stage buffer memory roughly by num_microbatches / (num_stages - stage_index + slack) on early/middle stages. For native interleaved 1F1B, receives are pooled using the lowered schedule’s actual lifetimes. Inputs are copied into independent leaves before forward, and gradients are copied before backward to protect checkpoint recomputation and escaping aliases. Other schedules are ignored with a warning. Defaults to False.
Extra buffer sets beyond the 1F1B in-flight depth when pp_recv_buffer_pool is enabled. Defaults to 2.
Pipeline schedule type. Supported values: “1f1b” (one-forward-one-backward), “gpipe”, “interleaved_1f1b”, “looped_bfs”, “dfs”, “v_schedule”, “zero_bubble”. Defaults to “1f1b”.
Path to a CSV file defining a custom pipeline schedule. If provided, overrides pp_schedule.
Sequence length hint for pipeline parallel shape inference. If None, it will be inferred from the dataset config.
When using virtual stages (interleaved schedules), round the number of virtual stages to a multiple of pp_size. “up” rounds up, “down” rounds down. If None, no rounding is applied.
Scale gradients within the pipeline schedule (by 1/n_microbatches). If False, gradients must be scaled externally. Defaults to False.
Validate the recv-buffer-pool knobs.
Convert config to dictionary.