bridge.models.deepseek.deepseek_v4_config#
Builder-backed model config for DeepSeek-V4 expressed as a Megatron-Core HybridModel.
Module Contents#
Classes#
MLA transformer config with the DeepSeek-V4 settings that every supported Megatron Core pin needs. |
|
DeepSeek-V4 config, the builder counterpart of |
|
Build DeepSeek-V4 with its DSA metric hook. |
Data#
API#
- class bridge.models.deepseek.deepseek_v4_config.DeepSeekV4TransformerConfig#
Bases:
megatron.bridge.models.transformer_config.MLATransformerConfigMLA transformer config with the DeepSeek-V4 settings that every supported Megatron Core pin needs.
- cp_partition_mode: Literal[zigzag, contiguous]#
‘zigzag’
Token assignment across context-parallel ranks on Megatron Core’s dev pin.
Megatron Core’s dev pin declares this field; its main pin does not. On the main pin,
dsv4_stepselects contiguous packed context parallelism throughattention_cp_layoutandlinear_cp_layoutinstead and does not read this field.
- class bridge.models.deepseek.deepseek_v4_config.DeepSeekV4ModelConfig#
Bases:
megatron.bridge.models.hybrid.model_config.BridgeHybridMLAModelConfigDeepSeek-V4 config, the builder counterpart of
DeepSeekV4HybridModelProvider.Each logical DeepSeek-V4 block is an attention-only Hybrid layer (
W,CorH) followed by a MoE-only layer (E), and each MTP depth appendsWE. Like the provider, it uses Hybrid construction and finalization with the DeepSeek-V4 MLA config and registers DSA metric setup after wrapping. It also rebuilds native pipeline segments after PP/VPP overrides and rejects segments that do not match the topology.- builder: ClassVar[str]#
‘megatron.bridge.models.deepseek.deepseek_v4_config.DeepSeekV4ModelBuilder’
- transformer_config_class: ClassVar[type[megatron.bridge.models.transformer_config.TransformerConfig]]#
None
- _pipeline_model_parallel_layout_builder(
- pipeline_model_parallel_size: int,
- virtual_pipeline_model_parallel_size: int | None,
Rebuild this config’s pattern and layout after runner PP/VPP overrides.
- validate() None#
Check the Hybrid settings and that the native pipeline segments match PP x VPP.
- get_builder_cls() type#
Use DSA setup when restoring an older config that saved the generic Hybrid builder.
- class bridge.models.deepseek.deepseek_v4_config.DeepSeekV4ModelBuilder#
Bases:
megatron.bridge.models.hybrid.BridgeHybridModelBuilderBuild DeepSeek-V4 with its DSA metric hook.
- build_distributed_models(
- pg_collection: megatron.core.process_groups_config.ProcessGroupCollection,
- *args: Any,
- **kwargs: Any,
Register DSA metric setup for the complete list of wrapped model chunks.
- bridge.models.deepseek.deepseek_v4_config.__all__#
[‘DeepSeekV4ModelBuilder’, ‘DeepSeekV4ModelConfig’, ‘DeepSeekV4TransformerConfig’]