10
10
Usage:
11
11
```shell
12
12
cd tools/checkpoint_conversion
13
- python convert_gemma_checkpoints .py --preset gemma3_instruct_1b
14
- python convert_gemma_checkpoints .py --preset gemma3_instruct_4b
13
+ python convert_gemma3_checkpoints .py --preset gemma3_instruct_1b
14
+ python convert_gemma3_checkpoints .py --preset gemma3_instruct_4b
15
15
```
16
16
"""
17
17
43
43
44
44
PRESET_MAP = {
45
45
# === Text ===
46
+ # 270M
47
+ "gemma3_instruct_270m" : {
48
+ "model" : gm .nn .Gemma3_270M ,
49
+ "params" : gm .ckpts .CheckpointPath .GEMMA3_270M_IT ,
50
+ },
51
+ "gemma3_270m" : {
52
+ "model" : gm .nn .Gemma3_270M ,
53
+ "params" : gm .ckpts .CheckpointPath .GEMMA3_270M_PT ,
54
+ },
46
55
# 1B
47
56
"gemma3_1b" : {
48
57
"model" : gm .nn .Gemma3_1B ,
@@ -493,7 +502,6 @@ def validate_output(
493
502
params = flax_params ,
494
503
multi_turn = False ,
495
504
cache_length = 256 if length <= 256 else 512 ,
496
- # max_out_length=length,
497
505
)
498
506
flax_output = flax_sampler .chat (input_str , images = image )
499
507
print ("🔶 Flax output:" , flax_output )
@@ -508,11 +516,11 @@ def main(_):
508
516
assert preset in presets , (
509
517
f"Invalid preset { preset } . Must be one of { ',' .join (presets )} "
510
518
)
511
- text_only = "text" in preset or "1b" in preset
519
+ text_only = "text" in preset or "1b" in preset or "270m" in preset
512
520
513
521
print ("🏃 Loading Flax model and tokeniser" )
514
522
flax_kwargs = {}
515
- if text_only and "1b" not in preset :
523
+ if text_only and "1b" not in preset and "270m" not in preset :
516
524
flax_kwargs ["text_only" ] = True
517
525
flax_model = PRESET_MAP [preset ]["model" ](** flax_kwargs )
518
526
flax_config = flax_model .config
0 commit comments