Python 官方文档:入门教程 => 点击学习
方法一: pip install --upgrade --force-reinstall Http://download.PyTorch.org/whl/cu80/torch-0
pip install --upgrade --force-reinstall Http://download.PyTorch.org/whl/cu80/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl
后面这个可以自己到官网上找自己对应的python和cuda版本的安装包,官网为链接:
conda install pytorch torchvision cuda80 -c soumith
这里可以根据自己cuda版本确定。查看cuda版本,在Python命令行里面输入:
import torch
torch.version.cuda
即可。
补充:关于win10环境下在使用torch调用cuda()失败的原因
看了无数篇博客都是牛头不对马嘴,忙活了半天才搞清楚
如果大家在用torch的过程中看见这样的错误。。。。淡定,不是你的问题,也不是代码问题。。。是破win10的原因
只需要在代码前面加上
torch.cuda.current_device()
torch.cuda._initialized = True
就可以正常训练了。。。心累啊
--结束END--
本文标题: 如何解决.cuda()加载用时很长的问题
本文链接: https://www.lsjlt.com/news/126703.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0