PyTorch 1.6学习
安装
1.对Anaconda进行一个新的用于pytorch的分区
conda create -n pytorch python=3.6
(base) C:\Users\26330>conda activate pytorch
(pytorch) C:\Users\26330>pip list
Package Version
---------- -------
pip 21.3.1
setuptools 58.0.4
wheel 0.37.1
2.进行相关环境
C:\Users\26330>conda activate pytorch
3.安装参考链接
链接: link.
C:\Users\26330>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Mon_Jan__9_17:32:33_CST_2017
Cuda compilation tools, release 8.0, V8.0.60
C:\Users\26330>nvidia-smi
Thu Jan 20 14:51:14 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 457.20 Driver Version: 457.20 CUDA Version: 11.1 |
|-------------------------------+----------------------+----------------------+
| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce GTX 1050 WDDM | 00000000:01:00.0 Off | N/A |
| N/A 31C P8 N/A / N/A | 75MiB / 4096MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=10.0 -c pytorch
检测是否安装成功
>>> import torch
>>> torch.cuda.is_available()
True
>>>
安装插件
conda install nb_conda
(pytorch) C:\Users\26330>jupyter notebook
[I 16:05:30.079 NotebookApp] [nb_conda_kernels] enabled, 3 kernels found
[I 16:05:31.003 NotebookApp] [nb_conda] enabled
[I 16:05:31.005 NotebookApp] Serving notebooks from local directory: C:\Users\26330
安装成功,很不容易