bridge.models.stepfun.step37_bridge#

Step3.7 multimodal bridge.

Registers a :class:MegatronModelBridge for the upstream Step3p7ForConditionalGeneration HF architecture (model_type step37). The bridge:

  • Maps the config to a builder-backed :class:Step37ModelConfig: the language fields come from :class:Step35Bridge applied to hf_config.text_config (the Step3.7 HF config nests its Step-3.5 text fields there), and the vision-tower fields (vision_config, image_token_id, projector_bias, understand_projector_stride) come from the top-level config.

  • Defines an HF↔Megatron parameter mapping registry that prefixes every Step-3.5 text mapping with language_model. (since

    class:

    Step37Model wraps the text GPTModel) and adds direct vision_model.* AutoMappings for the PE-G/14 trunk + downsamplers, plus a top-level vit_large_projector.weight mapping.

Module Contents#

Classes#

Step37Bridge

Megatron Bridge for Step3.7 (Step-3.5 text + Perception-Encoder G/14 vision).

Functions#

_lm

Prefix a Step-3.5 megatron_param with the language_model. namespace.

Data#

API#

bridge.models.stepfun.step37_bridge.logger#

‘getLogger(…)’

bridge.models.stepfun.step37_bridge._LM_PREFIX#

‘language_model.’

bridge.models.stepfun.step37_bridge._lm(megatron_param: str) → str#

Prefix a Step-3.5 megatron_param with the language_model. namespace.

class bridge.models.stepfun.step37_bridge.Step37Bridge#

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

Megatron Bridge for Step3.7 (Step-3.5 text + Perception-Encoder G/14 vision).

.. rubric:: Example

from megatron.bridge import AutoBridge bridge = AutoBridge.from_hf_pretrained(“stepfun-ai/Step-3.7-Flash”) model_config = bridge.get_model_config()

MODEL_CONFIG_CLASS#

None

USE_MODEL_CONFIG_FOR_CONVERSION#

True

CONFIG_MAPPING#

None

classmethod megatron_to_hf_config(
provider: megatron.bridge.models.stepfun.step37_config.Step37ModelConfig | megatron.bridge.models.stepfun.step37_provider.Step37ModelProvider,
) → dict#

Convert a Step3.7 model config or provider into its nested Hugging Face config.

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

Convert a Hugging Face Step3.7 config to builder config kwargs.

The language fields come from :class:Step35Bridge applied to hf_config.text_config. Where the Step3.7 provider configured a field differently, it is set here as the provider set it. The vision-language fields come from the top-level config.

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

Adapt the canonical builder mapping to the deprecated provider path.

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

Return the full text + vision parameter mapping registry.

Text mappings replicate :meth:Step35Bridge.mapping_registry with a language_model. prefix on every Megatron-side path (since

Class:

Step37Model wraps the Step-3.5 GPTModel under self.language_model). Vision mappings are direct AutoMappings — the Megatron module structure mirrors the HF safetensors layout.

bridge.models.stepfun.step37_bridge.__all__#

[‘Step37Bridge’]