bridge.models.minimax_m3.minimax_m3_builder#

Model builders for MiniMax-M3.

MiniMaxM3ModelBuilder builds the language model of MiniMaxM3ModelProvider, and MiniMaxM3VLModelBuilder the MiniMaxM3VLModel of MiniMaxM3VLModelProvider: the vision tower and projectors first, then the language model.

The router weights and expert biases and the vision patch embedding stay in FP32, as the checkpoint stores them. They are marked so that Float16Module leaves them in FP32.

Module Contents#

Classes#

MiniMaxM3ModelBuilder

Build the MiniMax-M3 language model with its routers in FP32.

MiniMaxM3VLModelBuilder

Combine the MiniMax-M3 language model with its vision tower and projectors.

Data#

API#

class bridge.models.minimax_m3.minimax_m3_builder.MiniMaxM3ModelBuilder#

Bases: megatron.bridge.models.gpt.gpt_builder.GPTModelBuilder

Build the MiniMax-M3 language model with its routers in FP32.

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,
) → megatron.core.models.gpt.GPTModel#

Build one MiniMax-M3 language-model pipeline stage.

Parameters:
  • pg_collection – Process groups used for distributed construction.

  • pre_process – Whether this stage owns the embeddings.

  • post_process – Whether this stage owns the output layer.

  • vp_stage – Virtual pipeline stage.

Returns:

A language-model stage whose router weights and expert biases are FP32.

Raises:

TypeError – If the builder was given another model config.

class bridge.models.minimax_m3.minimax_m3_builder.MiniMaxM3VLModelBuilder#

Bases: bridge.models.minimax_m3.minimax_m3_builder.MiniMaxM3ModelBuilder

Combine the MiniMax-M3 language model with its vision tower and projectors.

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,
) → megatron.bridge.models.minimax_m3.modeling_minimax_m3_vl.MiniMaxM3VLModel#

Build one MiniMax-M3 vision-language pipeline stage.

Parameters:
  • pg_collection – Process groups used for distributed construction.

  • pre_process – Whether this stage owns the embeddings, the vision tower and the projectors.

  • post_process – Whether this stage owns the language-model output layer.

  • vp_stage – Virtual pipeline stage.

Returns:

A MiniMax-M3 vision-language model stage.

Raises:
  • TypeError – If the builder was given another model config.

  • ValueError – If vision_config is unset.

bridge.models.minimax_m3.minimax_m3_builder.__all__#

[‘MiniMaxM3ModelBuilder’, ‘MiniMaxM3VLModelBuilder’]