基于GeForce GT 730显卡的Pytorch |
您所在的位置:网站首页 › gt710显卡怎么安装 › 基于GeForce GT 730显卡的Pytorch |
打开 cmd 面板,输入 nvidia-smi 命令, 显示 NVIDIA 显卡基本信息和相关进程占用显存情况 算力及显卡对照表:CUDA GPUs - Compute Capability | NVIDIA Developer GeForce GT 730-4G (DDR5) 的算力为3.5,根据算力匹配pytorch版本 配置步骤: 1.下载并安装 Anaconda; 2.在 Windows 上打开开始菜单并打开 Anaconda 命令提示符(Anaconda Prompt)。 3.创建pytorch环境; conda create -n PyTorch python=3.74.安装 pytorch: conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=10.0 -c pytorch测试是否安装成功: import torch torch.cuda.is_available() Out[2]: True显示True仅代表pytorch安装成功,再测试能否使用CUDA加速计算 torch.empty(3,4,device='cuda') 或者 torch.Tensor([1,2]).cuda()不报错说明环境配置成功 5.在pytorch环境下安装spyder 在Anaconda界面中选择pytorch环境安装spyder 4.1.4 直接使用该spyder会报错: ImportError: cannot import name 'PILLOW_VERSION' from 'PIL' 通过安装Pillow的旧版本解决了问题: pip uninstall Pillow pip install Pillow==6.2.2最后spyder可以正常使用。 测试CUDA加速: import torch # 以下代码只有在PyTorch GPU版本上才会执行 import time device = torch.device('cuda') a = torch.randn(10000,1000) b = torch.randn(1000,2000) t0 = time.time() c = torch.matmul(a,b) t1 = time.time() print(a.device,t1-t0,c.norm(2)) a = a.to(device) b = b.to(device) t0 = time.time() c = torch.matmul(a,b) t1 = time.time() print(a.device,t1-t0,c.norm(2)) t0 = time.time() c = torch.matmul(a,b) t1 = time.time() print(a.device,t1-t0,c.norm(2)) Nice,可以用了 参考: [1] https://blog.csdn.net/fscanf_fread/article/details/103846358在python环境中导入torchvision的时候,出现了以下错误ImportError: cannot import name 'PILLOW_VERSION' from 'PIL'我的系统环境如下,环境:系统:windows 10python:3.7pytorch:1.3.1torchvision:0.4.1经过排查,发现torchvision需要... [2] PyTorch测试代码-cuda加速_不要绝望总会慢慢变强的博客-CSDN博客import torch# 以下代码只有在PyTorch GPU版本上才会执行import timeprint(torch.__version__)print(torch.cuda.is_available())a = torch.randn(10000,1000)b = torch.randn(1000,2000)t0 = time.time()c = torch.matmul(a,b)t1 = time.time()print(a.device,t1-t0,c.norm(2)). |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |