bridge.models.gpt.model_config#

Serializable Bridge extension of Megatron-LM’s GPT model config.

Module Contents#

Classes#

BridgeGPTModelConfig

GPT model config with strict overrides and callable serialization.

BridgeGPTMLAModelConfig

GPT model config with Multi-Latent Attention (MLA), the builder counterpart of MLAModelProvider.

Data#

API#

class bridge.models.gpt.model_config.BridgeGPTModelConfig#

Bases: megatron.bridge.models.common.base.ModelConfigOverrideMixin, megatron.bridge.models.gpt.gpt_builder.GPTModelConfig, megatron.bridge.models.common.base.ModelConfig

GPT model config with strict overrides and callable serialization.

Outer GPT build fields and nested transformer fields keep one declared owner. Flat assignment remains convenient, but unknown names fail instead of silently creating phantom configuration.

Hugging Face source provenance (model id and revision) is not declared as a dedicated field here. It is recorded in the inherited serializable extra_checkpoint_metadata mapping so it round-trips through run_config.yaml without adding model-specific config fields. hf_model_text_only records that the source checkpoint was projected to its language model, so a restored config reopens the same projection.

transformer_config_class: ClassVar[type[megatron.bridge.models.transformer_config.TransformerConfig]]#

None

hf_model_text_only: bool#

False

Whether the source HF checkpoint was projected to its language model.

get_builder_cls() → type#

Resolve the configured builder through Bridge’s target allowlist.

as_dict() → dict[str, Any]#

Serialize the config with a symbolic activation function and a restorable pipeline layout.

classmethod from_dict(
data: dict[str, Any],
) → bridge.models.gpt.model_config.BridgeGPTModelConfig#

Deserialize a config while restoring its activation callable.

class bridge.models.gpt.model_config.BridgeGPTMLAModelConfig#

Bases: megatron.bridge.models.common.base.MLAModelConfigMixin, bridge.models.gpt.model_config.BridgeGPTModelConfig

GPT model config with Multi-Latent Attention (MLA), the builder counterpart of MLAModelProvider.

The nested transformer config is an MLATransformerConfig. It alone stores and serializes rotary_base and rotary_percent, because MLA attention applies RoPE from them; on this config they are constructor arguments and views of the nested values (see MLAModelConfigMixin). GPT MLA families such as Kimi K3 and Sarvam MLA use it, as their providers combine GPTModelProvider with an MLA config.

bridge.models.gpt.model_config.__all__#

[‘BridgeGPTMLAModelConfig’, ‘BridgeGPTModelConfig’]