hiyouga / LLaMA-Factory

Efficiently Fine-Tune 100+ LLMs in WebUI (ACL 2024)
https://arxiv.org/abs/2403.13372
Apache License 2.0
30.73k stars 3.79k forks source link

请教如何调整微调参数 #3644

Closed zhaoweihan2017 closed 4 months ago

zhaoweihan2017 commented 4 months ago

Reminder

Reproduction

背景:使用模型Qwen1.5-0.5B并在此模型基础上作微调训练。 数据集:采用https://huggingface.co/datasets/michaelwzhu/ShenNong_TCM_Dataset, 中医数据集 训练参数:

CUDA_VISIBLE_DEVICES=0 python src/train_bash.py \ --stage sft \ --do_train True \ --model_name_or_path /data/workspace/Qwen1.5-0.5B \ --finetuning_type lora \ --template qwen \ --flash_attn auto \ --dataset_dir data \ --dataset train_med_data_alpaca \ --cutoff_len 512 \ --learning_rate 5e-05 \ --num_train_epochs 3.0 \ --max_samples 100000 \ --per_device_train_batch_size 2 \ --gradient_accumulation_steps 8 \ --lr_scheduler_type cosine \ --max_grad_norm 1.0 \ --logging_steps 5 \ --save_steps 100 \ --warmup_steps 0 \ --optim adamw_torch \ --report_to none \ --output_dir saves/Qwen1.5-0.5B/lora/train_2024-05-09-13-52-med \ --fp16 True \ --lora_rank 8 \ --lora_alpha 16 \ --lora_dropout 0 \ --lora_target all \ --plot_loss True

问题/现象: 训练过程中模型一直不收敛,loss一直处于震荡状态。

5720F9B5-BA47-4bac-AE7B-231858AFE6FB

Expected behavior

希望能提供微调参数优化方案,使得模型最终微调效果较好。

System Info

No response

Others

No response

Fanb1ing commented 4 months ago

同求

hiyouga commented 4 months ago

用全参数训练

zhaoweihan2017 commented 4 months ago

@hiyouga 好的,谢谢您,我试一下