support qwen2vl train proj only

Former-commit-id: 0e949ef03455726e907c6f1039e93ebe480c897a
This commit is contained in:
hiyouga
2024-12-05 10:37:42 +00:00
parent be1ec97c8e
commit bac2c64f87
2 changed files with 4 additions and 4 deletions

View File

@@ -138,11 +138,10 @@ def get_forbidden_modules(config: "PretrainedConfig", finetuning_args: "Finetuni
forbidden_modules.add("language_model")
elif model_type == "qwen2_vl":
if finetuning_args.freeze_vision_tower:
forbidden_modules.add("visual")
if finetuning_args.train_mm_proj_only:
raise ValueError("Qwen2-VL models do not support `train_mm_proj_only`.")
forbidden_modules.update({"visual.patch_embed", "visual.blocks", "model", "lm_head"})
elif finetuning_args.freeze_vision_tower:
forbidden_modules.add("visual")
return forbidden_modules