一住涉、安裝概要
本說明針對windows安裝pytorch GPU訓(xùn)練環(huán)境使用(以下軟件版本號可以選擇其它版本但整體要一致比如cuda10.2命贴,pytorch也要10.2)
二舶赔、基本軟件安裝下載:
1.下載并安裝cuda toolkit10.2:
下載并安裝cudnn(cuda10.2版本)(需要注冊登陸nvidia社區(qū))
https://developer.nvidia.com/rdp/cudnn-download:
2.下載并安裝Anaconda :
Python 3.8
https://www.anaconda.com/products/individual:
https://repo.anaconda.com/archive/Anaconda3-2020.11-Windows-x86_64.exe
3.下載并安裝Pycharm:
https://www.jetbrains.com/pycharm/download/#section=windows
4. 安裝Pytorch 1.7.1:
以下a,b兩種方法任選一種(注意需要網(wǎng)絡(luò))
a.選用conda 安裝(傻瓜式安裝评抚,可不需要安裝第1步cuda及cudnn)
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch(官方源安裝)
或conda install pytorch torchvision torchaudio cudatoolkit=10.2(不使用官方源)
附conda 添加清華源方法
在C盤用戶目錄下新建.condarc文件,內(nèi)容如下:
channels:
??- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
??- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
??- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
??- defaults
show_channel_urls: true
b. 選用pip安裝(需要配合第1步cuda安裝使用)
pip install torch torchvision
附Pip添加清華源方法(或豆瓣源)
在C盤用戶目錄下新建pip文件夾坟漱,在pip文件夾中新建pip.ini文件鼠次,文件內(nèi)容如下:
[global]
index-url = http://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn
三、以上安裝完基本環(huán)境已經(jīng)配置完成芋齿,但訓(xùn)練時仍然需要安裝其他python依賴庫(如opencv-python腥寇,onnx等等,可使用pip install 安裝)