Pytorch
PyTorch介绍
特点:
1.简单易用、分布式训练、服务器部署方便、移动端部署方便;
2.PyTorch 是基于以下两个目的而打造的python科学计算框架:
无缝替换NumPy,并且通过利用GPU的算力来实现神经网络的加速。
3.通过自动微分机制,来让神经网络的实现变得更加容易。
参考网站:
https://github.com/pytorch/pytorch
https://pytorch.org/
https://pytorch.apachecn.org/#/docs/1.7/README
https://github.com/pytorch/examples
PyTorch安装
Python版本要求必须是64位的;CPU版本或者GPU版本任选一个版本安装即可;GPU版本的安装要求必须是NVIDIA显卡,并且安装好对应的驱动。
https://pytorch.org/get-started/locally/
https://pytorch.org/get-started/previous-versions/
https://developer.aliyun.com/mirror/anaconda/
1.设置conda国内源
conda config --set show_channel_urls yes
2.修改~/.condarc文件内容:
channels:
- https://mirrors.aliyun.com/anaconda/cloud/ursky
- https://mirrors.aliyun.com/anaconda/cloud/stackless
- https://mirrors.aliyun.com/anaconda/cloud/simpleitk
- https://mirrors.aliyun.com/anaconda/cloud/rdkit
- https://mirrors.aliyun.com/anaconda/cloud/rapidsai
- https://mirrors.aliyun.com/anaconda/cloud/qiime2
- https://mirrors.aliyun.com/anaconda/cloud/pyviz
- https://mirrors.aliyun.com/anaconda/cloud/pytorch3d
- https://mirrors.aliyun.com/anaconda/cloud/pytorch-test
- https://mirrors.aliyun.com/anaconda/cloud/pytorch
- https://mirrors.aliyun.com/anaconda/cloud/psi4
- https://mirrors.aliyun.com/anaconda/cloud/plotly
- https://mirrors.aliyun.com/anaconda/cloud/omnia
- https://mirrors.aliyun.com/anaconda/cloud/ohmeta
- https://mirrors.aliyun.com/anaconda/cloud/numba
- https://mirrors.aliyun.com/anaconda/cloud/msys2
- https://mirrors.aliyun.com/anaconda/cloud/mordred-descriptor
- https://mirrors.aliyun.com/anaconda/cloud/menpo
- https://mirrors.aliyun.com/anaconda/cloud/matsci
- https://mirrors.aliyun.com/anaconda/cloud/intel
- https://mirrors.aliyun.com/anaconda/cloud/idaholab
- https://mirrors.aliyun.com/anaconda/cloud/fermi
- https://mirrors.aliyun.com/anaconda/cloud/fastai
- https://mirrors.aliyun.com/anaconda/cloud/dglteam
- https://mirrors.aliyun.com/anaconda/cloud/deepmodeling
- https://mirrors.aliyun.com/anaconda/cloud/conda-forge
- https://mirrors.aliyun.com/anaconda/cloud/caffe2
- https://mirrors.aliyun.com/anaconda/cloud/c4aarch64
- https://mirrors.aliyun.com/anaconda/cloud/bioconda
- https://mirrors.aliyun.com/anaconda/cloud/biobakery
- https://mirrors.aliyun.com/anaconda/cloud/auto
- https://mirrors.aliyun.com/anaconda/cloud/Paddle
- https://mirrors.aliyun.com/anaconda/pkgs/r
- https://mirrors.aliyun.com/anaconda/pkgs/msys2
- https://mirrors.aliyun.com/anaconda/pkgs/main
- https://mirrors.aliyun.com/anaconda/pkgs/free
show_channel_urls: true
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
3.安装命令(版本根据自己需求选择):
conda install pytorch1.10.1 torchvision0.11.2 torchaudio==0.10.1
cpuonly -c pytorch
4. 查看是否安装成功
python
import torch
torch.cuda.is_available()
torch.rand(5,3)