在conda中配置环境pytorch环境:
注意:gpu版首先要安装CUDA和cudnn,cpu可以忽略。
设备要求:Compute Capability : https://developer.nvidia.com/cuda-gpus
- nVidia GTX650 or newer
- anaconda with python 3.6 or3.5
- CUDA tool kit (version 8)
- cudnn(version 6)
可以根据自己的设备选择CUDA版本:https://developer.nvidia.com/cuda-toolkit-archive
安装CUDA时可以直接默认安装,不做改变,具体修改的可以看一下自己不需要的,不勾选即可。
安装后在终端中用nvcc -V查看版本,即可。
再选择cudnn版本:https://developer.nvidia.com/rdp/cudnn-download,需要将指定的文件移动到CUDA安装路径下。
pytorch离线安装:
在官网根据python、CUDA版本下载指定的whl文件,进行离线安装:
Linux and Windows
# CUDA 10.0
Download and install wheel from https://download.pytorch.org/whl/cu100/torch_stable.html
# CUDA 9.0
Download and install wheel from https://download.pytorch.org/whl/cu90/torch_stable.html
# CUDA 8.0
Download and install wheel from https://download.pytorch.org/whl/cu80/torch_stable.html
# CPU only
Download and install wheel from https://download.pytorch.org/whl/cpu/torch_stable.html
安装pytorch:
pip install **.whl