bridge.models.sarvam.sarvam_mla_bridge#

Module Contents#

Classes#

SarvamMLABridge

Megatron Hub Bridge for Sarvam MLA Causal LM.

API#

class bridge.models.sarvam.sarvam_mla_bridge.SarvamMLABridge#

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

Megatron Hub Bridge for Sarvam MLA Causal LM.

This bridge handles the conversion between HuggingFace SarvamMLAForCausalLM and Megatron-Core GPTModel formats. Sarvam MLA models use multi-latent attention architecture.

.. rubric:: Example

from megatron.bridge import AutoBridge bridge = AutoBridge.from_hf_pretrained(“sarvamai/sarvam-105b”, trust_remote_code=True) 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,
) → dict[str, Any]#

Convert a Hugging Face Sarvam MLA config to builder config kwargs.

The architecture sizes and the YaRN settings come from the HF config; the remaining settings are fixed for the Sarvam MLA family, as SarvamMLAModelProvider sets them. Without a query LoRA, the DeepSeek block spec keeps the KV norm and omits the query norm that the checkpoint does not define.

hf_config_to_provider_kwargs(
hf_config: transformers.PretrainedConfig,
) → dict[str, Any]#

Adapt the canonical builder mapping to the deprecated SarvamMLAModelProvider path.

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