使用Recbole时指定gpu_id无效的解决方案

问题描述:使用Recbole时因为服务器的前几个gpu都被占用,想指定gpu_id为4,尝试使用命令行、yaml文件和config dict指定,均报错:

RuntimeError: CUDA out of memory. Tried to allocate 80.00 MiB (GPU 0; 23.70 GiB total capacity; 1.87 GiB already allocated; 49.56 MiB free; 1.93 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

大概意思时说GPU 0的内存不足,但是程序打印的参数列表显示gpu_id=4,说明程序无法识别指定gpu,可能有bug。

解决方法:使用命令行运行代码时在python run.py前添加CUDA_VISIBLE_DEVICES=4即可。

CUDA_VISIBLE_DEVICES=4 python run.py 

参考:https://github.com/RUCAIBox/RecBole/issues/925

  • 9
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值