0
点赞
收藏
分享

微信扫一扫

torch._C._cuda_setDevice(device)

1.问题原因:安装的事pytorch CPU版本;

torch._C._cuda_setDevice(device)_正常运行

2解决办法:

卸载已安装的pytorch,安装GPU 版本的pytorch

安装命令如下:

pip3 install torch torchaudio -i https://pypi.tuna.tsinghua.edu.cn/simple

安装过程有点长,安装过程运行如下:

torch._C._cuda_setDevice(device)_安装过程_02

安装完后验证是否安装成功:

import torch
torch.cuda.is_available()

torch._C._cuda_setDevice(device)_正常运行_03

显示True,代表安装成功啦!

接着就可以正常运行自己的代码啦。。。

举报

相关推荐

0 条评论