bridge.models.sarvam.sarvam_config#

Builder-backed model config for Sarvam MoE.

Module Contents#

Classes#

SarvamMoEModelConfig

GPT model config that keeps Sarvam MoE’s supported uneven pipeline layouts.

Functions#

_get_sarvam_moe_pipeline_layout

Return supported pipeline layouts for Sarvam MoE’s 19 decoder layers.

apply_sarvam_moe_pipeline_layout

Select a supported pipeline layout when the decoder layers do not divide evenly across PP.

Data#

API#

bridge.models.sarvam.sarvam_config._get_sarvam_moe_pipeline_layout(pp_size: int)#

Return supported pipeline layouts for Sarvam MoE’s 19 decoder layers.

bridge.models.sarvam.sarvam_config.apply_sarvam_moe_pipeline_layout(
config: GPTModelProvider | BridgeGPTModelConfig,
) → None#

Select a supported pipeline layout when the decoder layers do not divide evenly across PP.

Sarvam MoE has 19 transformer layers, so uneven PP requires an explicit layout rather than a generic first-stage override. Use known-good layouts for PP=2/4/8 unless the caller has already configured a custom flexible pipeline split.

Parameters:

config – Sarvam MoE provider or builder-backed model config, updated in place.

class bridge.models.sarvam.sarvam_config.SarvamMoEModelConfig#

Bases: megatron.bridge.models.gpt.model_config.BridgeGPTModelConfig

GPT model config that keeps Sarvam MoE’s supported uneven pipeline layouts.

Sarvam MoE builds with the standard GPT builder. The only addition over BridgeGPTModelConfig is the pipeline layout finalize() selects when the pipeline size does not divide the decoder layer count, matching the legacy SarvamMoEModelProvider.

finalize() → None#

Apply a supported layout for uneven pipeline parallelism, then finalize.

bridge.models.sarvam.sarvam_config.__all__#

[‘SarvamMoEModelConfig’, ‘apply_sarvam_moe_pipeline_layout’]