Skip to content

Commit faf38eb

Browse files
committed
Make vision_encoder_block configurable
1 parent 83527b8 commit faf38eb

17 files changed

Lines changed: 46 additions & 10 deletions

src/maxtext/common/common_types.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@ class DecoderBlockType(enum.Enum):
116116
DEEPSEEK4 = "deepseek4"
117117

118118

119+
class VisionEncoderBlockType(enum.Enum):
120+
"""Vision encoder block types."""
121+
122+
NONE = "none"
123+
GEMMA3 = "gemma3"
124+
LLAMA4 = "llama4"
125+
QWEN3_OMNI = "qwen3_omni"
126+
GEMMA4 = "gemma4"
127+
QWEN3_5 = "qwen3_5"
128+
QWEN3_VL = "qwen3_vl"
129+
130+
119131
class AttentionType(enum.Enum):
120132
GLOBAL = "global" # default, with causality
121133
LOCAL_SLIDING = "local_sliding"

src/maxtext/configs/models/gemma3-12b.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ rope_max_timescale: 1_000_000
3333
rope_linear_scaling_factor: 8.0
3434

3535
# Multimodal flags (need to set use_multimodal=true)
36+
vision_encoder_block: "gemma3"
3637
image_size_for_vit: 896
3738
num_channels_for_vit: 3
3839
patch_size_for_vit: 14

src/maxtext/configs/models/gemma3-27b.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ rope_max_timescale: 1_000_000
3333
rope_linear_scaling_factor: 8.0
3434

3535
# Multimodal flags (need to set use_multimodal=true)
36+
vision_encoder_block: "gemma3"
3637
image_size_for_vit: 896
3738
num_channels_for_vit: 3
3839
patch_size_for_vit: 14

src/maxtext/configs/models/gemma3-4b.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ rope_max_timescale: 1_000_000
3333
rope_linear_scaling_factor: 8.0
3434

3535
# Multimodal flags (need to set use_multimodal=true)
36+
vision_encoder_block: "gemma3"
3637
image_size_for_vit: 896
3738
num_channels_for_vit: 3
3839
patch_size_for_vit: 14

src/maxtext/configs/models/gemma4-26b.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ norm_topk_prob: true
4848
load_balance_loss_weight: 0.001
4949

5050
# Multimodal flags (need to set use_multimodal=true)
51+
vision_encoder_block: "gemma4"
5152
rope_theta_for_vit: 100
5253
image_size_for_vit: [672, 960]
5354
num_channels_for_vit: 3

src/maxtext/configs/models/gemma4-31b.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ local_rope_proportion: 1.0
4444
final_logits_soft_cap: 30.0
4545

4646
# Multimodal flags (need to set use_multimodal=true)
47+
vision_encoder_block: "gemma4"
4748
rope_theta_for_vit: 100
4849
image_size_for_vit: [672, 960]
4950
num_channels_for_vit: 3

src/maxtext/configs/models/gemma4-e2b.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ local_rope_proportion: 1.0
4545
final_logits_soft_cap: 30.0
4646

4747
# Vision encoder flags — multimodal not yet supported for E2B / E4B.
48+
vision_encoder_block: "gemma4"
4849
rope_theta_for_vit: 100
4950
image_size_for_vit: [672, 960]
5051
num_channels_for_vit: 3

src/maxtext/configs/models/gemma4-e4b.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ local_rope_proportion: 1.0
4646
final_logits_soft_cap: 30.0
4747

4848
# Vision encoder flags — multimodal not yet supported for E2B / E4B.
49+
vision_encoder_block: "gemma4"
4950
rope_theta_for_vit: 100
5051
image_size_for_vit: [672, 960]
5152
num_channels_for_vit: 3

src/maxtext/configs/models/llama4-17b-128e.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ temperature_tuning: true
4343
chunk_attn_window_size: 8192
4444

4545
# Multimodal flags (need to set use_multimodal=true)
46+
vision_encoder_block: "llama4"
4647
image_size_for_vit: 336
4748
num_channels_for_vit: 3
4849
patch_size_for_vit: 14

src/maxtext/configs/models/llama4-17b-16e.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ temperature_tuning: true
4343
chunk_attn_window_size: 8192
4444

4545
# Multimodal flags (need to set use_multimodal=true)
46+
vision_encoder_block: "llama4"
4647
image_size_for_vit: 336
4748
num_channels_for_vit: 3
4849
patch_size_for_vit: 14

0 commit comments

Comments
 (0)