bridge.models.bagel.conversion#

Hugging Face to MCore checkpoint conversion for BAGEL-7B-MoT.

Module Contents#

Classes#

BagelConfig

Config-only representation of the native BAGEL Hugging Face assets.

BagelBridge

Import official BAGEL tensors with the strict native checkpoint mapper.

Data#

API#

bridge.models.bagel.conversion.logger#

‘getLogger(…)’

class bridge.models.bagel.conversion.BagelConfig(
llm_config: dict[str, Any] | None = None,
vit_config: dict[str, Any] | None = None,
vae_config: dict[str, Any] | None = None,
**kwargs: Any,
)#

Bases: transformers.PretrainedConfig

Config-only representation of the native BAGEL Hugging Face assets.

Initialization

model_type#

‘bagel’

architectures#

[‘BagelForConditionalGeneration’]

class bridge.models.bagel.conversion.BagelBridge#

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

Import official BAGEL tensors with the strict native checkpoint mapper.

SUPPORTS_HF_PRETRAINED_EXPORT#

False

MODEL_CONFIG_CLASS#

None

provider_bridge(
hf_pretrained: megatron.bridge.models.hf_pretrained.causal_lm.PreTrainedCausalLM,
) → megatron.bridge.models.bagel.provider.BagelModelProvider#

Build the BAGEL provider from the nested official configuration.

mapping_registry() → megatron.bridge.models.conversion.mapping_registry.MegatronMappingRegistry#

Return an empty registry because import uses the native mapper.

load_weights_hf_to_megatron(
hf_pretrained: megatron.bridge.models.hf_pretrained.causal_lm.PreTrainedCausalLM,
megatron_model,
allowed_mismatched_params: list[str] | None = None,
) → list#

Load the complete native BAGEL state before distributed wrapping.