【大模型训练】deepseek-vl2 的微调
deepseek-vl2 是图文大模型,我想要微调它,来解析出章中的内容。
比如
公司名:xxxxx
sn:xxxxx
形状:方形、圆形、
仓库:https://github.com/deepseek-ai/DeepSeek-VL2

train命令
https://github.com/modelscope/ms-swift/blob/main/examples/models/deepseek_vl2/train.sh
# 9GiB
pip install "transformers==4.41.*" "peft==0.11.*"
# pip uninstall autoawq
CUDA_VISIBLE_DEVICES=0 \
swift sft \
--model deepseek-ai/deepseek-vl2-tiny \
--dataset 'AI-ModelScope/LaTeX_OCR:human_handwrite#20000' \
--load_from_cache_file true \
--split_dataset_ratio 0.01 \
--train_type lora \
--torch_dtype bfloat16 \
--num_train_epochs 1 \
--per_device_train_batch_size 1 \
--per_device_eval_batch_size 1 \
--learning_rate 1e-4 \
--lora_rank 8 \
--lora_alpha 32 \
--target_modules all-linear \
--freeze_vit true \
--gradient_accumulation_steps 16 \
--eval_steps 50 \
--save_steps 50 \
--save_total_limit 2 \
--logging_steps 5 \
--max_length 4096 \
--output_dir output \
--warmup_ratio 0.05 \
--dataset_num_proc 4 \
--dataloader_num_workers 4
transformer 必须要用这个:
transformers==4.41.*
否则会遇到这个错误:

ref:https://github.com/deepseek-ai/DeepSeek-VL2/issues/101
还有说可能训练用transformer训练比较慢,需要用另外一个,但是,我给找不到ref了。ref:https://github.com/modelscope/ms-swift/issues/2883
找到了,嘿嘿:

其实我也有这个问题,微调数据集的格式是什么?

https://github.com/modelscope/ms-swift/blob/release/2.5/docs/source/Multi-Modal/internvl%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5.md

这个intervl的最佳实践要好好看看!
加油

它给的是路径,我给的是base64不知道是否能训练起来。
然后这query和response也不是那么匹配。
格式这里也给了:
ref:https://pub.towardsai.net/fine-tuning-deepseek-vl2-for-multimodal-instruction-following-a-step-by-step-guide-13238ad704ac

新大陆
https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat_gpt_oss
这个也很厉害
更多推荐
所有评论(0)