bridge.models.qwen_vl.modeling_qwen35.hybrid_model#
Qwen3.5 vision-language composition with Core’s HybridModel decoder.
Module Contents#
Classes#
Marks a rotary call made outside a Qwen3.5 Hybrid language-model forward. |
|
Keep language graph wrappers separate from vision and feed-forward layers. |
|
Add multimodal rotary inputs to the already configured Hybrid decoder. |
|
Reuse Qwen vision encoding and modality insertion with a Hybrid language model. |
|
Qwen3.5’s existing classifier head over the Hybrid language model. |
Functions#
Whether Core’s TE CUDA graph helper will build static inputs for attention layers. |
|
Use Qwen’s absolute multimodal rotary attention in the Hybrid stack. |
Data#
API#
- class bridge.models.qwen_vl.modeling_qwen35.hybrid_model._OutsideForward#
Marks a rotary call made outside a Qwen3.5 Hybrid language-model forward.
- bridge.models.qwen_vl.modeling_qwen35.hybrid_model._OUTSIDE_FORWARD#
‘_OutsideForward(…)’
- bridge.models.qwen_vl.modeling_qwen35.hybrid_model._POSITION_IDS: contextvars.ContextVar[torch.Tensor | None | bridge.models.qwen_vl.modeling_qwen35.hybrid_model._OutsideForward]#
‘ContextVar(…)’
- bridge.models.qwen_vl.modeling_qwen35.hybrid_model._te_attn_cuda_graph_enabled(
- config: megatron.core.transformer.transformer_config.TransformerConfig,
Whether Core’s TE CUDA graph helper will build static inputs for attention layers.
- class bridge.models.qwen_vl.modeling_qwen35.hybrid_model._HybridMultimodalRotaryEmbedding#
Bases:
megatron.bridge.models.qwen_vl.modelling_qwen3_vl.rope.Qwen3VLMultimodalRotaryEmbedding- te_attn_cuda_graph: bool#
False
- forward(
- max_seq_len: int,
- *,
- packed_seq: bool = False,
- cp_group: torch.distributed.ProcessGroup | None = None,
- class bridge.models.qwen_vl.modeling_qwen35.hybrid_model.Qwen35VLHybridAttentionLayer#
Bases:
megatron.bridge.models.qwen_vl.modelling_qwen3_vl.transformer_layer.Qwen3VLRotaryTransformerLayerKeep language graph wrappers separate from vision and feed-forward layers.
- bridge.models.qwen_vl.modeling_qwen35.hybrid_model.qwen35_vl_hybrid_stack_spec() megatron.core.transformer.spec_utils.ModuleSpec#
Use Qwen’s absolute multimodal rotary attention in the Hybrid stack.
- class bridge.models.qwen_vl.modeling_qwen35.hybrid_model.Qwen35VLHybridLanguageModel(
- config: megatron.core.transformer.transformer_config.TransformerConfig,
- transformer_layer_spec: megatron.core.transformer.spec_utils.ModuleSpec,
- vocab_size: int,
- max_sequence_length: int,
- *,
- rotary_percent: float,
- rotary_base: int,
- hybrid_layer_pattern: str,
- position_embedding_type: str = 'mrope',
- mtp_block_spec: megatron.core.transformer.spec_utils.ModuleSpec | None = None,
- **kwargs: Any,
Bases:
megatron.core.models.hybrid.hybrid_model.HybridModelAdd multimodal rotary inputs to the already configured Hybrid decoder.
Initialization
- tie_embeddings_and_output_weights_state_dict(
- sharded_state_dict: megatron.core.dist_checkpointing.mapping.ShardedStateDict,
- output_layer_weight_key: str,
- first_stage_word_emb_key: str,
- metadata: dict | None = None,
Store tied MTP weights only in the embedding entry on the last stage.
- static _mtp_token_embedding_inputs(
- _module: torch.nn.Module,
- args: tuple[Any, ...],
- kwargs: dict[str, Any],
- forward(
- input_ids: torch.Tensor,
- position_ids: torch.Tensor,
- attention_mask: torch.Tensor | None,
- *,
- visual_pos_masks: torch.Tensor | None = None,
- deepstack_visual_embeds: list[torch.Tensor] | None = None,
- **kwargs: Any,
Pass explicit multimodal positions to Core’s rotary preparation and MTP path.