LLaMA-Factory
LLaMA-Factory copied to clipboard
Qwen1.5-14B-Chat lora训练评估问题
Reminder
- [X] I have read the README and searched the existing issues.
Reproduction
deepspeed --include localhost:0,1 --master_port=9901 ./src/train_bash.py
--deepspeed ds_3.json
--stage sft
--model_name_or_path /opt/llm/models/Qwen15-14B-Chat
--do_predict
--dataset train_all
--template qwen
--finetuning_type lora
--adapter_name_or_path ./output_qw/checkpoint-200
--output_dir ./output_qw/finall_eval
--per_device_eval_batch_size 1
--max_samples 50
--predict_with_generate
--cutoff_len 9000
--max_new_tokens 9000
--seed 42
--fp16
这是deepspeed配置:
{
"train_batch_size": "auto",
"train_micro_batch_size_per_gpu": "auto",
"gradient_accumulation_steps": "auto",
"gradient_clipping": "auto",
"zero_allow_untested_optimizer": true,
"fp16": {
"enabled": "auto",
"loss_scale": 0,
"initial_scale_power": 16,
"loss_scale_window": 1000,
"hysteresis": 2,
"min_loss_scale": 1
},
"zero_optimization": {
"stage": 3,
"contiguous_gradients": true,
"stage3_max_live_parameters": 1e9,
"stage3_max_reuse_distance": 1e9,
"stage3_prefetch_bucket_size": 1e9,
"stage3_param_persistence_threshold": "auto",
"reduce_bucket_size": 5e8,
"sub_group_size": 1e9,
"overlap_comm": true,
"stage3_gather_16bit_weights_on_model_save": true,
"offload_optimizer": {
"device": "cpu"
},
"offload_param": {
"device": "cpu"
}
}
}
Expected behavior
使用deepspeed完成lora训练后,打算用do_predict做一个自己训练集的评估。单纯使用python启动模型评估会显存溢出。打算使用deepspeed+zero3来完成模型加载与评估。现在能使用deespeed加载模型,但好像在评估的时候卡住了,无法进行。
现在已经40分钟了,还是没有输出。请帮忙看看什么问题。
System Info
transformers
version: 4.39.1
Python version: 3.10.0
PyTorch version (GPU?): 2.1.2+cu118 (True)
deepspeed version: 0.14.0
Others
No response
试试设置 --fp16_full_eval True
@hiyouga 我在训练Qwen1.5-moe的时候也遇到这个问题。开始训练后没有任何输出和报错,就这样卡住了。我最开始以为是没有print_loss的bug,但是运行了超过20个小时也依旧没有结果?用的是2.0.1+cu118、transformers是从github安装的最新的4.40.0。现在不确定是transformers库支持问题还是可能的框架问题?
把--fp16 换成 --fp16_full_eval True 但还是会卡住
@Qiang-HU 我试了一下eval,和你的情况也差不多,不知道是不是qwen模型的问题还是框架的问题。
@leeyusheng 你们不是同一个问题,我感觉你卡住更像是 NCCL 通信问题
@hiyouga 可是同样的程序和环境,把Qwen1.5-moe换成Qwen1.4-14B就能正常训练。可能是transformers还不支持的原因吗?
@leeyusheng 你是用 zero2 吗
@leeyusheng 你是用 zero2 吗
是的
我重新拉了一遍项目代码,相同的参数运行还是会卡住
我又换了chatglm3+lora微调的模型,还是会卡在相同的位置
换成python启动chatglm3+lora微调的评估就正常
我有尝试不加载lora微调部分,直接用原始模型进行评估,还是卡住,不过在零卡少了几个进程
@Qiang-HU 现在 do_predict 尚不支持 deepspeed
把--fp16 换成 --fp16_full_eval True 但还是会卡住
两个参数都要带上。。
没办法了 都带上也试过了 依旧会卡住
@leeyusheng 更新下代码试试 zero3 能不能跑
@leeyusheng 更新下代码试试 zero3 能不能跑
似乎还是不行。。。。。