gemma4

Model type

gemma4

Class

Gemma4Model

Task

gemma4

Source

models/gemma4.py

Description

Unified Gemma4 multimodal model (3- or 4-model split).

Builds three or four separate ONNX models depending on whether the config includes an audio sub-config:

Always produced:

  • decoder: Gemma4 text decoder taking inputs_embeds

  • vision_encoder: SigLIP-style encoder + projector

  • embedding: scaled word embedding + multimodal feature fusion

Added when config.audio is not None:

  • audio_encoder: Conformer audio encoder + projection to text hidden size

Covers all Gemma4 variants:

  • Vision-language (26B-A4B, 31B): audio=None

  • Any-to-Any (E2B-it, E4B-it): audio=Gemma4AudioConfig(...)

Registered as gemma4 (and gemma4_any_to_any for back-compat).

Usage

mobius build --model <MODEL_ID> output_dir/
from mobius import build

model = build("<MODEL_ID>")