bridge.models.qwen.modeling_qwen35.hybrid#
Qwen3.5 composition of Core’s separate attention and feed-forward layers.
Module Contents#
Classes#
Keep TE’s class-level graph wrappers separate from the MoE/MLP subclasses. |
Functions#
Assign Hybrid positions to PP/VPP stages without splitting HF blocks. |
|
Expand each HF block into a GDN/attention position followed by its MLP. |
|
Keep Core’s GDN and MLP kernels while enabling Qwen’s per-head Q/K norms. |
|
Convert the language configuration from HF block coordinates to Hybrid positions. |
|
Recover HF block counts and attention order from a finalized Hybrid pattern. |
|
Translate GPT block templates to split Hybrid positions, retaining expert wildcards. |
API#
- class bridge.models.qwen.modeling_qwen35.hybrid.Qwen35HybridAttentionLayer#
Bases:
megatron.core.transformer.transformer_layer.TransformerLayerKeep TE’s class-level graph wrappers separate from the MoE/MLP subclasses.
Capturing TransformerLayer and its subclasses together can retain an inherited autocast wrapper on uncaptured MTP layers after graph creation. A sibling attention class preserves those layers’ quantization contexts.
- bridge.models.qwen.modeling_qwen35.hybrid.qwen35_pipeline_pattern(
- config: megatron.core.transformer.transformer_config.TransformerConfig,
- pattern: str,
Assign Hybrid positions to PP/VPP stages without splitting HF blocks.
- bridge.models.qwen.modeling_qwen35.hybrid.qwen35_hybrid_pattern(
- text_config: transformers.PretrainedConfig,
Expand each HF block into a GDN/attention position followed by its MLP.
- bridge.models.qwen.modeling_qwen35.hybrid.qwen35_hybrid_stack_spec() megatron.core.transformer.spec_utils.ModuleSpec#
Keep Core’s GDN and MLP kernels while enabling Qwen’s per-head Q/K norms.
- bridge.models.qwen.modeling_qwen35.hybrid.configure_qwen35_hybrid(
- config_kwargs: dict[str, Any],
- text_config: transformers.PretrainedConfig,
Convert the language configuration from HF block coordinates to Hybrid positions.
- bridge.models.qwen.modeling_qwen35.hybrid.qwen35_hf_layer_config(pattern: str) dict[str, Any]#
Recover HF block counts and attention order from a finalized Hybrid pattern.
- bridge.models.qwen.modeling_qwen35.hybrid.qwen35_hybrid_mappings(
- mappings: list[megatron.bridge.models.conversion.param_mapping.MegatronParamMapping],
- *,
- num_layers: int,
Translate GPT block templates to split Hybrid positions, retaining expert wildcards.