pytorch 支持amd显卡吗_Windows系统安装和使用PyTorch 0.4.0 (官方已经支持 Windows )...

本文介绍了PyTorch 0.4.0版本开始支持Windows系统,并提供了详细的Windows系统安装PyTorch的多种方法,包括conda和pip安装,同时提到了GPU和CPU版本的选择,以及安装后如何测试是否成功。
摘要由CSDN通过智能技术生成

Windows系统安装和使用PyTorch 0.4.0 (官方已经支持 Windows )

发布时间:2018-04-25 20:52,

浏览次数:800

, 标签:

Windows

PyTorch

PyTorch 0.4.0 官方已经支持 Windows 系统

2018年4月25号,PyTorch 官方发布 0.4.0 版本,该版本的 PyTorch 有多项重大更新,其中最重要的改进是官方支持 Windows

(详细改动见Pytorch官方GitHub ):

* Tensor/Variable 合并

* 零维张量

* 数据类型

* 迁移指南

* Windows 支持

* C++ 扩展

* ONNX 改进 支持 RNN

* Bug修复与性能优化

Pytorch官网 新增安装方式——Windows安装

Windows各种安装方式汇总:

#使用conda安装,不支持python2.7,cudanone就是CPU版本的 'conda,cuda8,python3.5': conda

install pytorch -c pytorch'conda,cuda9.0,python3.5': conda install pytorch

cuda90 -c pytorch'conda,cuda9.1,python3.5': conda install pytorch cuda91

'conda,cudanone,python3.5': conda install pytorch-cpu -c pytorch

'conda,cuda8,python3.6': conda install pytorch -c pytorch

'conda,cuda9.0,python3.6': conda install pytorch cuda90 -c pytorch

'conda,cuda9.1,python3.6': conda install pytorch cuda91 -c pytorch

'conda,cudanone,python3.6': conda install pytorch-cpu -c pytorch

#使用pip安装,不支持python2.7,cudanone就是CPU版本的 'pip,cudanone,python3.5': pip3 install

http://download.pytorch.org/whl/cpu/torch-0.4.0-cp35-cp35m-win_amd64.whl

'pip,cuda8,python3.5': pip3 install http://download.pytorch.org/whl/cu80/torch-

0.4.0-cp35-cp35m-win_amd64.whl 'pip,cuda9.0,python3.5': pip3 install

http://download.pytorch.org/whl/cu90/torch-0.4.0-cp35-cp35m-win_amd64.whl

'pip,cuda9.1,python3.5': pip3 install

http://download.pytorch.org/whl/cu91/torch-0.4.0-cp35-cp35m-win_amd64.whl

'pip,cudanone,python3.6': pip3 install

http://download.pytorch.org/whl/cpu/torch-0.4.0-cp36-cp36m-win_amd64.whl

'pip,cuda8,python3.6': pip3 install http://download.pytorch.org/whl/cu80/torch-

0.4.0-cp36-cp36m-win_amd64.whl 'pip,cuda9.0,python3.6': pip3 install

http://download.pytorch.org/whl/cu90/torch-0.4.0-cp36-cp36m-win_amd64.whl

'pip,cuda9.1,python3.6': pip3 install

http://download.pytorch.org/whl/cu91/torch-0.4.0-cp36-cp36m-win_amd64.whl #源码编译

需要安装VS2017,我电脑没有,所以略过。

Windows用户能直接通过conda、pip和源码编译三种方式来安装Pytorch了,假如我们用pip来安装的话:

* 安装GPU版本,如:Windows+pip+python 3.6+CUDA 8 ,只需在cmd中输入: pip install

http://download.pytorch.org/whl/cu80/torch-0.4.0-cp36-cp36m-win_amd64.whl

* 如果电脑没有英伟达显卡,那就只能安装CPU版本的,如:Windows+pip+python 3.6 ,在cmd中输入: pip install

http://download.pytorch.org/whl/cpu/torch-0.4.0-cp36-cp36m-win_amd64.whl

* 最后需要安装 torchvision,我是通过本地安装的方式进行安装的,下载地址:(

https://pypi.python.org/pypi/torchvision/0.2.1

)下载好之后,用cmd进入torchvision所在的文件夹下,输入下面的命令安装: pip install torchvision-0.2.1-py2.py3

-none-any.whl

测试一下是否安装好了,看看能不能用GPU加速:

>>>import torch >>>torch.__version__ >>>torch.cuda.is_available()

有几个小伙伴反馈安装后会出现一些问题,官方文档

针对一些问题给出了解决方案,在知乎 上有大神也给出了一些解决方案。

1.import torch失败

#import torch时出现以下错误: from torch._C import * ImportError: DLL load failed: The

specified module couldnot be found. #解决方案:缺少了必要的一些动态链接库,或者没英伟达显卡而误装了GPU版本的

在cmd中输入:conda install -c peterjc123 vc vs2017_runtime

2.运行错误

#使用pytorch时出现的多进程错误,如下描述: RuntimeError: An attempt has been made to start a

new process before the current process has finished its bootstrapping phase.

This probably means that you arenot using fork to start your child processes and

you have forgotten to use the proper idiomin the main module: if __name__ ==

'__main__': freeze_support() ... The "freeze_support()" line can be omitted if

the programis not going to be frozen to produce an executable. #解决方案如下: import

torchdef main() for i, data in enumerate(dataloader): # do something here if

__name__ =='__main__': main()

我个人装的是Win10+GPU版本的,CUDA8+cuDNN

v7,考虑到cuDNN需要注册才能下载,而且下载速度贼慢,提供两个百度云的下载链接,cuDNN安装教程见这个博客

Win10-x64+CUDA8+cuDNN v7

Win10-x64+CUDA8+cuDNN v6

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值