已解决
Win10系统下torch.cuda.is_available()返回为False的问题解决
来自网友在路上 161861提问 提问时间:2023-11-09 04:23:32阅读次数: 61
最佳答案 问答题库618位专家为你答疑解惑
Q: Win10系统下torch.cuda.is_available()返回为False
(l2) D:\opt\l2>pythonPython 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:34:57) [MSC v.1936 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import torch>>> torch.cuda.is_available()False
A: 安装指定的torchGPU版本
经查网上资料,说默认用官网命令安装的最新版torch是不加载cuda加速的,而且版本不匹配,需要手动指定版本安装
第一步,卸载已安装的torch2.10版本
pip3 uninstall torch torchvision torchaudioFound existing installation: torch 2.1.0Uninstalling torch-2.1.0:Would remove:c:\users\xxxxxx\.conda\envs\l2\lib\site-packages\functorch\*c:\users\xxxxxx\.conda\envs\l2\lib\site-packages\torch-2.1.0.dist-info\*c:\users\xxxxxx\.conda\envs\l2\lib\site-packages\torch\*c:\users\xxxxxx\.conda\envs\l2\lib\site-packages\torchgen\*c:\users\xxxxxx\.conda\envs\l2\scripts\convert-caffe2-to-onnx.exec:\users\xxxxxx\.conda\envs\l2\scripts\convert-onnx-to-caffe2.exec:\users\xxxxxx\.conda\envs\l2\scripts\torchrun.exeProceed (Y/n)? ySuccessfully uninstalled torch-2.1.0Found existing installation: torchvision 0.16.0Uninstalling torchvision-0.16.0:Would remove:c:\users\xxxxxx\.conda\envs\l2\lib\site-packages\torchvision-0.16.0.dist-info\*c:\users\xxxxxx\.conda\envs\l2\lib\site-packages\torchvision\*Proceed (Y/n)? ySuccessfully uninstalled torchvision-0.16.0Found existing installation: torchaudio 2.1.0Uninstalling torchaudio-2.1.0:Would remove:c:\users\xxxxxx\.conda\envs\l2\lib\site-packages\torchaudio-2.1.0.dist-info\*c:\users\xxxxxx\.conda\envs\l2\lib\site-packages\torchaudio\*Proceed (Y/n)? ySuccessfully uninstalled torchaudio-2.1.0
第二步,安装指定版本的2.0.1的GPU版本
pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1+cu118 -f https://download.pytorch.org/whl/torch_stable.html
也可以离线下载GPU版本,2.0.0,2.0.1, 2.1.0:
https://download.pytorch.org/whl/cu118/torch-2.0.0%2Bcu118-cp310-cp310-win_amd64.whl
https://download.pytorch.org/whl/cu118/torch-2.0.1%2Bcu118-cp310-cp310-win_amd64.whl
https://download.pytorch.org/whl/cu118/torch-2.1.0%2Bcu118-cp310-cp310-win_amd64.whl
(l2) D:\opt\l2>python
Python 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:34:57) [MSC v.1936 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import torch>>> torch.cuda.is_available()True>>>
查看全文
99%的人还看了
相似问题
- flink1.13.6版本的应用程序(maven版)
- 技术分享| gcc版本升级到5.2
- 基于 Glibc 版本升级的 DolphinDB 数据查询性能优化实践
- 解决requests 2.28.x版本SSL错误:证书验证失败
- UE5和UE4版本更新重大改变汇总。
- Docker build报错总结,版本过新大避雷!
- K8S1.23.5部署(此前1.17版本步骤囊括)及问题记录
- Mongodb3.4升级高版本mongoTemplate.executeCommand报错The cursor option is required
- onnx模型转换opset版本和固定动态输入尺寸
- centos安装指定版本docker
猜你感兴趣
版权申明
本文"Win10系统下torch.cuda.is_available()返回为False的问题解决":http://eshow365.cn/6-35863-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!