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

How to fine-tune llava-v1.6-mistral-7b on GQA dataset #1544

Open
qhz991029 opened this issue Jun 4, 2024 · 8 comments
Open

How to fine-tune llava-v1.6-mistral-7b on GQA dataset #1544

qhz991029 opened this issue Jun 4, 2024 · 8 comments

Comments

@qhz991029
Copy link

qhz991029 commented Jun 4, 2024

Question

Thank you for your great work!

I am trying to fine-tune llava-v1.6-mistral-7b on the provided GQA dataset, using the script finetune_task_lora.sh. However, the loss dosen't decrease and test result on GQA is worse. I wonder how should I fine-tune llava-v1.6 models?

This is the modified script:

#!/bin/bash

deepspeed --include "node-0:0,1,2,3" llava/train/train_mem.py \
    --lora_enable True --lora_r 128 --lora_alpha 256 --mm_projector_lr 2e-5 \
    --deepspeed ./scripts/zero2.json \
    --model_name_or_path liuhaotian/llava-v1.5-7b \
    --version mistral_instruct \
    --data_path /SOME/PATH/TO/LLaVA/playground/gqa.json \
    --data_length 10000 \
    --image_folder ./playground/data \
    --vision_tower openai/clip-vit-large-patch14-336 \
    --mm_patch_merge_type spatial_unpad \
    --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 anyres \
    --group_by_modality_length True \
    --bf16 True \
    --output_dir ./checkpoints/llava-v1.5-7b-gqa-official-lora \
    --num_train_epochs 1 \
    --per_device_train_batch_size 16 \
    --per_device_eval_batch_size 4 \
    --gradient_accumulation_steps 1 \
    --evaluation_strategy "no" \
    --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 4096 \
    --gradient_checkpointing True \
    --dataloader_num_workers 8 \
    --lazy_preprocess True \
    --report_to wandb

This the modified part in train.py:

model = LlavaMistralForCausalLM.from_pretrained(
                model_args.model_name_or_path,
                cache_dir=training_args.cache_dir,
                attn_implementation=attn_implementation,
                torch_dtype=(torch.bfloat16 if training_args.bf16 else None),
                **bnb_model_from_pretrained_args
            )
tokenizer = transformers.AutoTokenizer.from_pretrained(
            model_args.model_name_or_path,
            cache_dir=training_args.cache_dir,
            model_max_length=training_args.model_max_length,
            padding_side="left"
        )

Looking forward to reply!

@NicoZenith
Copy link

There is not training script for 1.6 unfortunately...

@YuyangYe
Copy link

YuyangYe commented Jun 9, 2024

There is not training script for 1.6 unfortunately...

Hello, I was wondering if there is a current training script available for version 1.6? Thank you!

@NicoZenith
Copy link

what do you guys think of this ?
https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LLaVa/Fine_tune_LLaVa_on_a_custom_dataset_(with_PyTorch_Lightning).ipynb

By replacing llava by lava-next (processor and model)

@dacian7
Copy link

dacian7 commented Jun 28, 2024

There is not training script for 1.6 unfortunately...

Hello, I was wondering if there is a current training script available for version 1.6? Thank you!

Hi @YuyangYe , have you found the scripts for that? Thanks!

@sweetning0809
Copy link

There is not training script for 1.6 unfortunately...

have you find any progress on this?

@sweetning0809
Copy link

there are some works on mac Blaizzy/mlx-vlm#43

@sweetning0809
Copy link

sweetning0809 commented Jul 2, 2024

what do you guys think of this ? https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LLaVa/Fine_tune_LLaVa_on_a_custom_dataset_(with_PyTorch_Lightning).ipynb

By replacing llava by lava-next (processor and model)

maybe is the right way

@NicoZenith
Copy link

There is not training script for 1.6 unfortunately...

have you find any progress on this?

Yes, the owner of this repo answered on another issue:
https://github.com/chuangchuangtan/LLaVA-NeXT-Image-Llama3-Lora

The fine-tuning does work with llama3! I suggest we move to his repo if we have new issues.

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

5 participants