[model] add gemma3n (#8509)

This commit is contained in:
Kingsley
2025-07-01 22:37:24 +08:00
committed by GitHub
parent cbb65567a9
commit e9f70daabe
5 changed files with 82 additions and 1 deletions

View File

@@ -204,6 +204,13 @@ _register_composite_model(
)
_register_composite_model(
model_type="gemma3n",
vision_model_keys=["vision_tower", "audio_tower"],
lora_conflict_keys=["timm_model", "subsample_conv_projection"],
)
# copied from qwen2vl
_register_composite_model(
model_type="glm4v",

View File

@@ -178,6 +178,9 @@ def patch_model(
resize_embedding_layer(model, tokenizer)
if is_trainable:
if getattr(model.config, "model_type", None) == "gemma3n":
setattr(model_args, "disable_gradient_checkpointing", True)
prepare_model_for_training(model, model_args)
autocast_projector_dtype(model, model_args)
add_z3_leaf_module(model)