bridge.training.gtp#
Generalized Tensor Parallelism helpers for the standard Bridge runtime.
Module Contents#
Functions#
Return the MCore transformer config nested in a Bridge model config. |
|
Read dense/expert TP and GTP sizes from runtime or serialized configs. |
|
Reject native resharding when either side uses the GTP SwiGLU layout. |
|
Return DP x dense GTP, excluding CP ranks that repeat the same samples. |
|
Return whether dense or expert GTP weight rematerialization is enabled. |
|
Configure process-global GTP state before constructing model modules. |
|
Classify all model chunks after distributed wrapping and before first forward. |
|
Return the group spanning every rank that consumes distinct input data. |
API#
- bridge.training.gtp.get_transformer_config(model_config: Any) Any#
Return the MCore transformer config nested in a Bridge model config.
- bridge.training.gtp._get_checkpoint_weight_topology(
- model_config: Any,
Read dense/expert TP and GTP sizes from runtime or serialized configs.
- bridge.training.gtp._validate_checkpoint_weight_topology(
- *,
- saved: tuple[int, int, int, int],
- requested: tuple[int, int, int, int],
Reject native resharding when either side uses the GTP SwiGLU layout.
- bridge.training.gtp._get_dataloader_process_group(
- pg_collection: megatron.core.process_groups_config.ProcessGroupCollection,
Return DP x dense GTP, excluding CP ranks that repeat the same samples.
- bridge.training.gtp.is_gtp_remat_active(model_config: Any) bool#
Return whether dense or expert GTP weight rematerialization is enabled.
- bridge.training.gtp.configure_gtp_remat(
- model_config: Any,
- *,
- reduce_scatter_with_fp32_accumulation: bool = False,
- nccl_ub: bool = False,
- pg_collection: megatron.core.process_groups_config.ProcessGroupCollection | None = None,
Configure process-global GTP state before constructing model modules.
- Parameters:
model_config – Model provider or builder config containing the GTP sizes.
reduce_scatter_with_fp32_accumulation – Accumulate GTP reduce-scatter results locally in FP32.
nccl_ub – Register an NCCL symmetric-memory pool for the dense GTP group.
pg_collection – Initialized process groups, required when nccl_ub is enabled.
- Raises:
RuntimeError – GTP is active but the required Transformer Engine support is missing.
ValueError – GTP is active and nccl_ub is enabled without process groups.
- bridge.training.gtp.classify_gtp_remat_chains(
- model: list[torch.nn.Module],
- model_config: Any,
Classify all model chunks after distributed wrapping and before first forward.
- bridge.training.gtp.get_data_distribution_group(
- pg_collection: megatron.core.process_groups_config.ProcessGroupCollection,
- model_config: Any,
- *,
- with_context_parallel: bool = False,
Return the group spanning every rank that consumes distinct input data.