Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Usage] After fine-tuning LLaVA 1.5, mm_projector.bin file is not available #1592

Open
rayluo88 opened this issue Jul 5, 2024 · 2 comments

Comments

@rayluo88
Copy link

rayluo88 commented Jul 5, 2024

Describe the issue

Issue: I have fine tuned the llava-v1.5-7b with lora. And in the output directory I got some files.

  • adapter_model.safetensors
  • config.json
  • README.md
  • adapter_config.json
  • non_lora_trainables.bin
  • trainer_state.json

The mm_projector.bin file is missing, which is required by scripts/merge_lora_weights.py and run_llava.py (llava/eval/run_llava.py)

The mm_projector.bin file contains the projector weights, right? How to generate/extract this file? @haotian-liu

Command:

deepspeed llava/train/train_mem.py \
    --lora_enable True --lora_r 128 --lora_alpha 256 --mm_projector_lr 2e-5 \
    --deepspeed $DEEPSPEED_JSON \
    --model_name_or_path $MODEL_NAME \
    --version v1 \
    --data_path $DATA_PATH \
    --image_folder $IMAGE_FOLDER \
    --vision_tower $VISION_TOWER \
    --mm_projector_type mlp2x_gelu \
    --mm_vision_select_layer -2 \
    --mm_use_im_start_end False \
    --mm_use_im_patch_token False \
    --image_aspect_ratio pad \
    --group_by_modality_length True \
    --bf16 True \
    --output_dir $OUTPUT_DIR \
    --num_train_epochs 1 \
    --per_device_train_batch_size 16 \
    --per_device_eval_batch_size 4 \
    --gradient_accumulation_steps 1 \
    --save_strategy "steps" \
    --save_steps 50000 \
    --save_total_limit 1 \
    --learning_rate 2e-4 \
    --weight_decay 0. \
    --warmup_ratio 0.03 \
    --lr_scheduler_type "cosine" \
    --logging_steps 1 \
    --tf32 True \
    --model_max_length 2048 \
    --gradient_checkpointing True \
    --dataloader_num_workers 4 \
    --lazy_preprocess True \
    --report_to wandb

Log:

PASTE THE LOGS HERE.

Screenshots:
You may attach screenshots if it better explains the issue.

@DemonsAH
Copy link

Add 'lora' in the folder name helped mine.
Merged model could run inference and showed the affection of fine-tuning.
I assume you can run inference without merging if you add 'lora' in the folder name.

@HuizhaoWang
Copy link

Describe the issue

Issue: I have fine tuned the llava-v1.5-7b with lora. And in the output directory I got some files.

  • adapter_model.safetensors
  • config.json
  • README.md
  • adapter_config.json
  • non_lora_trainables.bin
  • trainer_state.json

The mm_projector.bin file is missing, which is required by scripts/merge_lora_weights.py and run_llava.py (llava/eval/run_llava.py)

The mm_projector.bin file contains the projector weights, right? How to generate/extract this file? @haotian-liu

Command:

deepspeed llava/train/train_mem.py \
    --lora_enable True --lora_r 128 --lora_alpha 256 --mm_projector_lr 2e-5 \
    --deepspeed $DEEPSPEED_JSON \
    --model_name_or_path $MODEL_NAME \
    --version v1 \
    --data_path $DATA_PATH \
    --image_folder $IMAGE_FOLDER \
    --vision_tower $VISION_TOWER \
    --mm_projector_type mlp2x_gelu \
    --mm_vision_select_layer -2 \
    --mm_use_im_start_end False \
    --mm_use_im_patch_token False \
    --image_aspect_ratio pad \
    --group_by_modality_length True \
    --bf16 True \
    --output_dir $OUTPUT_DIR \
    --num_train_epochs 1 \
    --per_device_train_batch_size 16 \
    --per_device_eval_batch_size 4 \
    --gradient_accumulation_steps 1 \
    --save_strategy "steps" \
    --save_steps 50000 \
    --save_total_limit 1 \
    --learning_rate 2e-4 \
    --weight_decay 0. \
    --warmup_ratio 0.03 \
    --lr_scheduler_type "cosine" \
    --logging_steps 1 \
    --tf32 True \
    --model_max_length 2048 \
    --gradient_checkpointing True \
    --dataloader_num_workers 4 \
    --lazy_preprocess True \
    --report_to wandb

Log:

PASTE THE LOGS HERE.

Screenshots: You may attach screenshots if it better explains the issue.

I also encountered this problem, have you solved it yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants