Win10系统下torch.cuda.is

编程入门 行业动态 更新时间:2024-10-19 08:54:31

Win10<a href=https://www.elefans.com/category/jswz/34/1770742.html style=系统下torch.cuda.is"/>

Win10系统下torch.cuda.is

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 .html

也可以离线下载GPU版本,2.0.0,2.0.1, 2.1.0:

.0.0%2Bcu118-cp310-cp310-win_amd64.whl

.0.1%2Bcu118-cp310-cp310-win_amd64.whl

.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>>>

更多推荐

Win10系统下torch.cuda.is

本文发布于:2023-11-16 01:25:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1611107.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:系统   cuda   torch

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!