标题: llamafactory用多卡4090服务器,训练qwen14B大模型时报错GPU显存不足oom(o [打印本页] 作者: 铁佛 时间: 2024-12-10 23:07 标题: llamafactory用多卡4090服务器,训练qwen14B大模型时报错GPU显存不足oom(o (llamafactory用多张4090卡,训练qwen14B大模型时oom(out of memory)报错,torch.OutOfMemoryError:CUDA out of memory,Tried to allocate 136MB,GPU 5 has a total capacity of 23.64GB which 16.56MB is free,已办理)
1.问题形貌
通过export CUDA_VISIBLE_DVICES=0,1,2,3,4,5,6,7指定使用8张显卡,训练qwen2.5-7B大模型时正常,但训练qwen2.5-14B,qwen2.5-32B模型时报错,torch.OutOfMemoryError:CUDA out of memory,Tried to allocate 136MB,GPU 5 has a total capacity of 23.64GB which 16.56MB is free 。
大概意思就是说GPU显存不足,很明显不符合实际,我的8张4090卡总显存是8*24GB,理论上14B的大模型肯定能跑起来。
linux服务器环境:
系统:Ubuntu22;
硬件:本机512G内存,8张4090显卡;
python:3.10版本;
llamafactory版本:0.9.1.dev0;
cuda版本:12.4版本;
pytorch版本:2.4.0+cuda121(GPU);
大模型:qwen2.5(7B,14B,32B,72B)Instruct版;