在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