bridge.models.glm_moe_dsa.glm5_config#

Builder-backed model config for the GLM-5 DSA family.

Module Contents#

Classes#

GLM5ModelConfig

GLM-5 as DSA, dense and MoE Hybrid layers with MLA, the builder counterpart of GLM5ModelProvider.

GLM5ModelBuilder

Build GLM-5 stages from GLM’s Hybrid stack spec, as GLM5ModelProvider does.

Data#

API#

class bridge.models.glm_moe_dsa.glm5_config.GLM5ModelConfig#

Bases: megatron.bridge.models.hybrid.model_config.BridgeHybridMLAModelConfig

GLM-5 as DSA, dense and MoE Hybrid layers with MLA, the builder counterpart of GLM5ModelProvider.

validate() checks GLM’s physical layout and training settings without changing the config. finalize() then places DSA-aligned pipeline boundaries in hybrid_layer_pattern and derives the MTP pattern and MoE layer schedule, as the provider does, before the Hybrid finalization.

builder: ClassVar[str]#

‘megatron.bridge.models.glm_moe_dsa.glm5_config.GLM5ModelBuilder’

validate() → None#

Check the Hybrid settings and GLM’s physical layout without changing the config.

finalize() → None#

Validate, then preserve DSA sharing within each pipeline stage and derive GLM’s layer settings.

class bridge.models.glm_moe_dsa.glm5_config.GLM5ModelBuilder#

Bases: megatron.bridge.models.hybrid.BridgeHybridModelBuilder

Build GLM-5 stages from GLM’s Hybrid stack spec, as GLM5ModelProvider does.

The spec isolates DSA index-sharing state per forward and replays a whole stage on recomputation. Like the provider, the builder uses it regardless of hybrid_stack_spec.

build_distributed_models(
pg_collection: megatron.core.process_groups_config.ProcessGroupCollection,
*args: Any,
**kwargs: Any,
) → list[megatron.core.models.hybrid.hybrid_model.HybridModel]#

Register DSA metric setup for the complete list of wrapped model chunks.

_resolve_hybrid_stack_spec() → megatron.core.transformer.spec_utils.ModuleSpec#

Return GLM’s Hybrid stack spec.

bridge.models.glm_moe_dsa.glm5_config.__all__#

[‘GLM5ModelBuilder’, ‘GLM5ModelConfig’]