InternVL icon indicating copy to clipboard operation
InternVL copied to clipboard

Merge Full Fine-tuning/LoRA Weights

Open nx3782 opened this issue 11 months ago • 4 comments

Him thanks so much again for providing the finetuning scripts on InternVL3_5 models.

But I wonder if I should use this script: "/InternVL/internvl_chat_llava/scripts/merge_lora_weights.py" or "/InternVL/internvl_chat/tools/merge_lora.py" to merge LoRA weights from each saved step?

I fine-tuned 1B model with this script: "/InternVL/internvl_chat_gpt_oss/shell/internvl3_5_qwen3/internvl3_5_1b_sft.sh".

Thanks

nx3782 avatar Dec 06 '25 07:12 nx3782

Actually I think I did a full fine-tuning here since all of them are set to False: --freeze_llm False
--freeze_mlp False
--freeze_backbone False \

However, it seems that I missed some files in the saved step folder in the screenshot below:

Image

Right now I am having this issue which makes sense because there is no such file in the saved step folder: OSError: /data/naihao/InternVL/internvl_chat_gpt_oss/shell/internvl3_5_qwen3/work_dirs/internvl3_5_1b_sft_lingshu_baseline/internvl3_5_1b_sft/checkpoint-50 does not appear to have a file named configuration_internvl_chat.py. Checkout '/InternVL/internvl_chat_gpt_oss/shell/internvl3_5_qwen3/work_dirs/internvl3_5_1b_sft/internvl3_5_1b_sft/checkpoint-50/tree/main' for available files.

nx3782 avatar Dec 06 '25 07:12 nx3782

Update: I tried to copy and paste the new model.safetensors file into the original internvl3_5-1B-IT folder; however, I got size mismatch issue.

size mismatch for position_embedding: copying a param with shape torch.Size([1, 257, 1024]) from checkpoint, the shape in current model is torch.Size([1, 1025, 1024]).

nx3782 avatar Dec 06 '25 08:12 nx3782

Is this because the vision encoder (backbone) also updated during the full fine-tuning? I tried fine tune intervl3-1B-it, same mismatch error even following your merge guide here: https://internvl.readthedocs.io/en/latest/internvl3.0/finetune.html

nx3782 avatar Dec 06 '25 20:12 nx3782

Never mind. Problem fixed when setting this back to default: --max_dynamic_patch 12 \

nx3782 avatar Dec 06 '25 22:12 nx3782