bridge.models.glm_moe_dsa.glm5_bridge#

Module Contents#

Classes#

GLM5Bridge

Megatron Bridge for the GLM-5 family (MoE + MLA + DSA).

Data#

API#

bridge.models.glm_moe_dsa.glm5_bridge.logger#

‘getLogger(…)’

class bridge.models.glm_moe_dsa.glm5_bridge.GLM5Bridge#

Bases: megatron.bridge.models.conversion.model_bridge.MegatronModelBridge

Megatron Bridge for the GLM-5 family (MoE + MLA + DSA).

This bridge handles conversion between HuggingFace GlmMoeDsaForCausalLM and Megatron-Core GPTModel formats. zai-org/GLM-5, zai-org/GLM-5.1, and zai-org/GLM-5.2 are auto-detected through this bridge, with version-specific DSA settings read from the HF config.

The architecture uses Multi-Latent Attention (MLA), Dynamic Sparse Attention (DSA) indexer layers, and Mixture-of-Experts (MoE). Requires transformers>=5.2.0.

.. rubric:: Example

from megatron.bridge import AutoBridge bridge = AutoBridge.from_hf_pretrained(“zai-org/GLM-5.1”) provider = bridge.to_megatron_provider()

_should_map_hf_config_field(
hf_config: Any,
hf_name: str,
megatron_name: str,
value: Any,
) bool#

Return whether an HF config field should be mapped to the Megatron provider.

provider_bridge(
hf_pretrained: megatron.bridge.models.hf_pretrained.causal_lm.PreTrainedCausalLM,
) megatron.bridge.models.mla_provider.MLAModelProvider#
mapping_registry() megatron.bridge.models.conversion.mapping_registry.MegatronMappingRegistry#