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

Why is flash attention not supported when fine tuning ovis2 #3258

Open
mehamednews opened this issue Feb 24, 2025 · 0 comments
Open

Why is flash attention not supported when fine tuning ovis2 #3258

mehamednews opened this issue Feb 24, 2025 · 0 comments

Comments

@mehamednews
Copy link

mehamednews commented Feb 24, 2025

Describe the bug
I tried running ms-swift to fine tune ovis2 (https://huggingface.co/AIDC-AI/Ovis2-1B).
I keep getting an error that ovis2 does not support flash attetion but they claim to support flash attention in their github repository: AIDC-AI/Ovis#44

without flash attention I always get OOM errors (even with the 1B model on a 4090).
this is the command I'm running:

USE_HF=1 CUDA_VISIBLE_DEVICES=0 swift sft \
  --model ovis2 \
  --model AIDC-AI/Ovis2-1B \
  --output-dir ovis2-1b-att1 \
  --train_type lora \
  --freeze_vit true \
  --lora_rank 8 \
  --lora_alpha 32 \
  --dataset ./label-dataset-train.jsonl \
  --val_dataset ./label-dataset-val.jsonl \
  --num_train_epochs 3 \
  --learning_rate 5e-6 \
  --warmup_ratio 0.25 \
  --save_only_model true \
  --eval_steps 25 \
  --dataloader_num_workers 1 \
  --max_pixels 1003520 \
  --attn_impl flash_attn
ValueError: Ovis does not support Flash Attention 2.0 yet. Please request to add support where the model is hosted, on its model hub page: https://huggingface.co//home/ab/.cache/huggingface/hub/models--AIDC-AI--Ovis2-1B/snapshots/2d2b94c33f1876797bead75c057cf9a9d6e2181a/discussions/new or in the Transformers GitHub repo: https://github.com/huggingface/transformers/issues/new

I'm not sure if I'm doing something wrong. Any help would be appreciated.

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

1 participant