feat✨: 添加OLORA支持,新增训练脚本并更新现有代码以适应新配置
This commit is contained in:
parent
266fcd57ad
commit
42df13390d
@ -1 +1 @@
|
||||
Subproject commit f58e3bd57f3f6cf2f713edaac4b8a54ecafe8e20
|
||||
Subproject commit a6e39fafb4e3ccce27671ce14afe62fb754c83c2
|
@ -18,7 +18,7 @@ accelerate launch --config_file configs/accelerate_configs/deepspeed_zero1.yaml
|
||||
--lr_scheduler_type cosine \
|
||||
--bf16 \
|
||||
--torch_dtype bfloat16 \
|
||||
--logging_steps 100 \
|
||||
--logging_steps 300 \
|
||||
--gradient_checkpointing \
|
||||
--weight_decay 0.1 \
|
||||
--eval_strategy steps \
|
25
src/scripts/train_omni_olora.sh
Executable file
25
src/scripts/train_omni_olora.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
accelerate launch --config_file configs/accelerate_configs/deepspeed_zero1.yaml train.py \
|
||||
--dataset_name textvqa \
|
||||
--use_peft \
|
||||
--peft_type OLORA \
|
||||
--model_name_or_path Qwen/Qwen2.5-Omni-3B \
|
||||
--lora_target_modules .*model\.layers.*proj\|.*merger.*0\|.*merger.*1 \
|
||||
--lora_r 8 \
|
||||
--lora_alpha 32 \
|
||||
--per_device_train_batch_size 3 \
|
||||
--per_device_eval_batch_size 1 \
|
||||
--gradient_accumulation_steps 2 \
|
||||
--num_train_epochs 1 \
|
||||
--output_dir checkpoint/qwen2_5omni_olora/ \
|
||||
--learning_rate 2e-4 \
|
||||
--warmup_ratio 0.03 \
|
||||
--lr_scheduler_type cosine \
|
||||
--bf16 \
|
||||
--torch_dtype bfloat16 \
|
||||
--logging_steps 300 \
|
||||
--gradient_checkpointing \
|
||||
--weight_decay 0.1 \
|
||||
--eval_strategy steps \
|
||||
# --resume_from_checkpoint /root/autodl-tmp/zhouyunyao/projects/CL-LMM/src/checkpoint/qwen2_5omni_moelora/checkpoint-1500
|
13
src/todo.md
13
src/todo.md
@ -17,7 +17,7 @@
|
||||
|
||||
[2025.01.19]
|
||||
|
||||
- [ ] 多个数据集引入
|
||||
- [x] 多个数据集引入
|
||||
- [ ] 对于混合模态数据 batchsize只能为1 性能太低 要调整模型代码(也不一定有用)
|
||||
- [ ] 引入EWC和LWF
|
||||
|
||||
@ -34,9 +34,14 @@
|
||||
- [x] MoeLora
|
||||
- [ ] Coin Benchmark
|
||||
- [x] 确定保存什么,便于后期测试
|
||||
- [ ] Olora
|
||||
- [ ] Hide-Llava
|
||||
- [x] Olora (非实现问题,loss越来越高,感觉很难训练)
|
||||
- [ ] Hide-Llava(复写基类引入clip,不同的adapter做平均,loralinear根据不同的name做插入top layer或正常layer,模型要求接受传入task_id即clip计算的最大相似)
|
||||
- [ ] Hide-llava问题,前些层平均fusion很没有道理,后些层的moe处理,却整整引入了clip的计算量,(任务数确定task数量,使得一些方法没有扩展性)。现实场景要求:没法知道后面还有多少个数据集,然后减少遗忘,最好能够对后续未见数据集产生效果,moelora问题只能适当缓解,利用不同的参数承接不同的任务。 那这个benchmark,每次输入保留数据,baseline是进一个把之前所有的都训练一边,持续学习方法使用update的方式,比较不同数据集按批次输入的收益(找函数定义[How Efficient Are Today’s Continual Learning Algorithms?],[]),也就是准确度的积分。
|
||||
|
||||
[2025.05.30]
|
||||
|
||||
- [ ] 评价指标
|
||||
- [x] 评价指标
|
||||
|
||||
[2025.06.03]
|
||||
|
||||
- [ ] 预期算法,低计算成本,
|
||||
|
13
src/train.py
13
src/train.py
@ -83,6 +83,19 @@ if __name__ == "__main__":
|
||||
)
|
||||
|
||||
model.add_adapter(peft_config)
|
||||
|
||||
elif model_args.peft_type == "OLORA":
|
||||
from peft.tuners import LoraConfig
|
||||
|
||||
peft_config = LoraConfig(
|
||||
target_modules=model_args.lora_target_modules,
|
||||
r=model_args.lora_r,
|
||||
lora_alpha=model_args.lora_alpha,
|
||||
lora_dropout=model_args.lora_dropout,
|
||||
init_lora_weights="olora"
|
||||
)
|
||||
|
||||
model.add_adapter(peft_config)
|
||||
|
||||
else:
|
||||
peft_config = None
|
||||
|
Loading…
Reference in New Issue
Block a user