mixle.utils.parallel.megatron_training module¶
Megatron Bridge adapter for full transformer and MoE parallelism.
Megatron owns the transformer partitioner and training loop. Mixle owns the statistical/parallel plan and maps it into a Bridge model provider without importing Megatron unless this backend is selected.
- class MegatronBridgeBackend[source]
Bases:
objectMap a
ParallelPlanonto NVIDIA Megatron Bridge providers.- static configure_provider(provider, plan)[source]
Apply the Mixle plan to a mutable Bridge model provider.
- static configure_distributed_optimizer(config, plan)[source]
Enable sharded optimizer/parameter state and overlap on a Bridge config.
- prepare(module, *, plan, **kwargs)[source]
Finalize a provider and construct its distributed model.
- class MegatronBridgeSession(model, *, plan, capabilities, train_batch_fn=None, optimizer=None, precision='bf16')[source]
Bases:
objectA materialized Bridge model for callers that supply a custom batch step.
Normal frontier pretraining should call
MegatronBridgeBackend.run_pretrain(); Bridge then owns schedules, inter-stage transfers, distributed optimizer overlap, and checkpoint cadence.train_batchexists for integration tests and specialized loops and never silently substitutes a local step.- Parameters:
model (Any)
plan (ParallelPlan)
capabilities (BackendCapabilities)
train_batch_fn (Any)
optimizer (Any)
precision (str)