bridge.models.hy_v3.hy_v3_bridge#
Module Contents#
Classes#
Megatron Bridge for Hy V3 MoE Causal LM. |
Data#
API#
- bridge.models.hy_v3.hy_v3_bridge.__all__#
[‘HYV3Bridge’]
- class bridge.models.hy_v3.hy_v3_bridge.HYV3Bridge#
Bases:
megatron.bridge.models.conversion.model_bridge.MegatronModelBridgeMegatron Bridge for Hy V3 MoE Causal LM.
This bridge handles the conversion between HuggingFace HYV3ForCausalLM and Megatron-Core GPTModel formats. Hy V3 is a fine-grained MoE decoder with GQA + QK layernorm, dense-first layer freq, sigmoid router with per-expert bias, shared experts, and grouped-GEMM routed experts.
.. rubric:: Example
from megatron.bridge import AutoBridge bridge = AutoBridge.from_hf_pretrained(“tencent/Hy3-preview-Base”) model_config = bridge.get_model_config()
- MODEL_CONFIG_CLASS#
None
- USE_MODEL_CONFIG_FOR_CONVERSION#
True
- hf_config_to_model_config_kwargs(
- hf_config: transformers.PretrainedConfig,
Convert a Hugging Face Hy V3 config to builder config kwargs.
The builder’s default MoE layer spec already uses the GPT decoder block spec, which honors the dense-first
moe_layer_freq.
- hf_config_to_provider_kwargs(
- hf_config: transformers.PretrainedConfig,
Adapt the canonical builder mapping to the deprecated provider path.
- classmethod megatron_to_hf_config(
- provider: megatron.bridge.models.gpt_provider.GPTModelProvider,
Convert Megatron provider config to HuggingFace HYV3Config dict.
- mapping_registry() megatron.bridge.models.conversion.mapping_registry.MegatronMappingRegistry#