bridge.models.gemma_vl.gemma4_vl_builder#
Model builders for Gemma 4 vision-language models.
Both builders construct the existing Gemma4VLModel as the legacy Gemma4VLModelProvider
and Gemma4DenseVLProvider do: the Hugging Face vision (and audio) encoders first, then the
language model from the Gemma 4 text builder.
Module Contents#
Classes#
Combine the Gemma 4 MoE language model with the Hugging Face vision encoder. |
|
Combine the Gemma 4 dense language model with the Hugging Face vision and audio encoders. |
Functions#
Data#
API#
- bridge.models.gemma_vl.gemma4_vl_builder._build_gemma4_vl_model(
- model_config: megatron.bridge.models.gemma_vl.gemma4_vl_config.Gemma4VLModelConfig | megatron.bridge.models.gemma_vl.gemma4_vl_config.Gemma4DenseVLModelConfig,
- build_language_model: collections.abc.Callable[..., megatron.core.models.gpt.GPTModel],
- pg_collection: megatron.core.process_groups_config.ProcessGroupCollection,
- pre_process: bool | None,
- post_process: bool | None,
- vp_stage: int | None,
- class bridge.models.gemma_vl.gemma4_vl_builder.Gemma4VLModelBuilder#
Bases:
megatron.bridge.models.gemma.gemma4_builder.Gemma4ModelBuilderCombine the Gemma 4 MoE language model with the Hugging Face vision encoder.
- build_model(
- pg_collection: megatron.core.process_groups_config.ProcessGroupCollection,
- pre_process: bool | None = None,
- post_process: bool | None = None,
- vp_stage: int | None = None,
Build one Gemma 4 MoE vision-language pipeline stage.
- Parameters:
pg_collection – Process groups used for distributed construction.
pre_process – Whether this stage owns the embeddings and the vision encoder.
post_process – Whether this stage owns the language-model output layer.
vp_stage – Virtual pipeline stage.
- Returns:
A Gemma 4 vision-language model stage.
- Raises:
TypeError – If the builder was given another model config.
ValueError – If
vision_configortext_configis unset.
- class bridge.models.gemma_vl.gemma4_vl_builder.Gemma4DenseVLModelBuilder#
Bases:
megatron.bridge.models.gemma.gemma4_builder.Gemma4DenseModelBuilderCombine the Gemma 4 dense language model with the Hugging Face vision and audio encoders.
- build_model(
- pg_collection: megatron.core.process_groups_config.ProcessGroupCollection,
- pre_process: bool | None = None,
- post_process: bool | None = None,
- vp_stage: int | None = None,
Build a Gemma 4 dense vision-language model.
- Parameters:
pg_collection – Process groups used for distributed construction.
pre_process – Whether to build the embeddings and the vision encoder.
post_process – Whether to build the language-model output layer.
vp_stage – Virtual pipeline stage; Gemma 4 dense supports none.
- Returns:
A Gemma 4 dense vision-language model.
- Raises:
TypeError – If the builder was given another model config.
ValueError – If
vision_configortext_configis unset.
- bridge.models.gemma_vl.gemma4_vl_builder.__all__#
[‘Gemma4DenseVLModelBuilder’, ‘Gemma4VLModelBuilder’]