bridge.models.common.base#

Module Contents#

Classes#

ModelConfigOverrideMixin

Route flat overrides to their declared owner and reject unknown fields.

ModelConfig

Bridge compatibility wrapper for Megatron-LM model configs.

Functions#

deserialize_model_config

Deserialize a builder config, including persisted enum and dtype values.

API#

bridge.models.common.base.deserialize_model_config(
data: dict[str, Any],
) → megatron.training.models.base.ModelConfig#

Deserialize a builder config, including persisted enum and dtype values.

class bridge.models.common.base.ModelConfigOverrideMixin#

Route flat overrides to their declared owner and reject unknown fields.

Builder-backed model configs store Megatron-Core transformer settings in a nested transformer dataclass while exposing flat assignment for recipe compatibility. This mixin keeps that convenience without allowing typos to create phantom configuration attributes. Subclasses declare the nested config type through transformer_config_class.

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

None

__setattr__(name: str, value: Any, /) → None#

Assign a declared outer or nested field and reject phantom fields.

class bridge.models.common.base.ModelConfig#

Bases: megatron.training.models.base.ModelConfig

Bridge compatibility wrapper for Megatron-LM model configs.

get_builder_cls() → type#

Get the appropriate builder type for this config.

classmethod from_dict(
data: dict[str, Any],
) → megatron.training.models.base.ModelConfig#

Deserialize config from dictionary with Bridge target validation.