-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Description
I use the following bash script for finetuning model using LoRA. The loss went down to almost zero, however, when I tried to evaluate the model using the exact data set for training, accuracy is only about 60-70%.
Can someone help me pinpointing the problem with settings below?
#!/bin/bash
# You can use 2B instead of 7B
# MODEL_NAME="Qwen/Qwen2-VL-7B-Instruct"
# MODEL_NAME="Qwen/Qwen2-VL-2B-Instruct"
MODEL_NAME="Qwen/Qwen2.5-VL-3B-Instruct"
# MODEL_NAME="Qwen/Qwen2.5-VL-7B-Instruct"
export PYTHONPATH=src:$PYTHONPATH
# GLOBAL_BATCH_SIZE=128
# BATCH_PER_DEVICE=4
# NUM_DEVICES=8
GLOBAL_BATCH_SIZE=128
BATCH_PER_DEVICE=4
NUM_DEVICES=4
GRAD_ACCUM_STEPS=$((GLOBAL_BATCH_SIZE / (BATCH_PER_DEVICE * NUM_DEVICES)))
# If your dataset is mixed with images and videos, you need to use zero2.
CUDA_VISIBLE_DEVICES=4,5,6,7 deepspeed src/train/train_sft.py \
--use_liger True \
--lora_enable True \
--vision_lora True \
--freeze_llm True \
--use_dora False \
--lora_namespan_exclude "['lm_head', 'embed_tokens']" \
--lora_rank 64 \
--lora_alpha 64 \
--lora_dropout 0.05 \
--num_lora_modules -1 \
--deepspeed scripts/zero3_offload.json \
--model_id $MODEL_NAME \
--data_path /workspace/data/small.json \
--image_folder /path/to/your/image/folder \
--remove_unused_columns False \
--freeze_vision_tower True \
--freeze_merger False \
--bf16 True \
--fp16 False \
--disable_flash_attn2 False \
--output_dir output/finetuned_test_4fps \
--num_train_epochs 50 \
--per_device_train_batch_size $BATCH_PER_DEVICE \
--gradient_accumulation_steps $GRAD_ACCUM_STEPS \
--video_max_pixels $((1280 * 720)) \
--fps 4 \
--learning_rate 1e-5 \
--merger_lr 1e-5 \
--vision_lr 2e-6 \
--weight_decay 0.1 \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--gradient_checkpointing True \
--report_to tensorboard \
--lazy_preprocess True \
--save_strategy "steps" \
--save_steps 5 \
--save_total_limit 10 \
--dataloader_num_workers 4 \
Metadata
Metadata
Assignees
Labels
No labels