当前位置:网站首页>[pytorch] install torch 1.8.1 and check whether torch version and GPU are available

[pytorch] install torch 1.8.1 and check whether torch version and GPU are available

2022-07-26 05:04:00 zoetu

stay conda Virtual environment installation torch==1.8.1+gpu edition .

The native environment

CUDA 11.1
python 3.7

install torch1.8.1

Use online installation , Offline installation requires downloading the corresponding torch、torchvision、torchaudia Installation package is a little troublesome .

1. Find the corresponding on the official website cuda edition  Insert picture description here

2. Installation command

pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

If the version cannot be found , Please use pip3 install

 Insert picture description here


View version

import torch
#  testing torch、cuda、cudnn edition 
print(torch.__version__)
print(torch.version.cuda)
print(torch.backends.cudnn.version())

# Is it available gpu
flag = torch.cuda.is_available()
print(flag)

 Insert picture description here

原网站

版权声明
本文为[zoetu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/207/202207260501304069.html