当前位置:网站首页>Summarize two methods of configuring pytorch GPU environment
Summarize two methods of configuring pytorch GPU environment
2022-06-25 09:12:00 【Zitian】
Summarize the latest configuration pytorch GPU Two methods of environmental protection
A pit that has been trodden on for two days , Summarize two methods to take you step by step
We install all the software we use according to the latest version
One : install anaconda
1. open anaconda Official website
anaconda Official website
Because my English is not very good , I opened the translation button in the browser , But the interface is the same
2. Scroll bar to the end , Click personal , Go to download page 
3. Click to download 
4. After downloading , Open the downloaded executable 
4.1 Click the second button to make it available to all users 
4.2 Select the installation directory , I'll change it here directly to D disc 
4.3 It's all marked here


4.4 Remove these two √, Click on Finish Complete the installation 
Two : Check and update the graphics card driver
1. Right click to open the control panel 
1.1 Click Help → system information

1.2 You can see that the driver version is 425.25
1.3 Click on the component , You can see the support CUDA highest 10.1 edition

1.4 The following is the graphics card driver version and cuda Version of the for diagrams
\

\
2 You can view the graphics card model in the control panel

NVIDIA Official website https://www.nvidia.cn/Download/index.aspx?lang=cn#
2.2 Here, choose your own graphics card model to download and install , I choose GeForce MX250,
2.3 You can install by default 
\
2.4 After restarting, you can enter the control panel again to check the driver version and supported CUDA edition

\
3、 ... and : install PyTorch
(1): establish pytorch Environmental Science
Different projects require different environments ,anaconda It can manage each environment well
1, Click on Anaconda Prompt Enter the command window 
2 The preceding parentheses are the current environment ,base It's the name of the environment 
3 Create a file called pytorch Environment
3.1 Enter the following :
conda create -n pytorch python=3.8
pytorch It's the name of the environment , You can change it yourself
python=3.8 yes python Version of , You can change it yourself 
3.2 The packages to be installed are listed above , Input y Confirm installation
4 Switch to pytorch Environment
4.1 Enter the following :
conda activate pytorch

You can see that the preceding parentheses become pytorch
(2): Switch to Tsinghua source image
Because you can download it directly from the official website pytorch Or downloading other packages will be very slow , Even the download is interrupted , So switch to some mirror websites in China
1 Switch to Tsinghua source
Run the following command :
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
You can see that a... Is generated under the user directory .condarc file , The content inside is the index of the mirror website

(3): install PyTorch
Method 1:PyTorch One click installation on the official website
1 add to pytorch library
Enter the following command :
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
2 open PyTorch Official website 
3 Select the corresponding version
I choose 10.2( I don't know what the problem is , I choose 11.3 Words , Test returns flase)
Copy the generated command
conda install pytorch torchvision torchaudio cudatoolkit=10.2
Take care to remove the following -c pytorch ( -c pytorch It's from pytorch Download from the official address , Remove to download from the mirror website )
4 In the command window, enter the command you just copied
conda install pytorch torchvision torchaudio cudatoolkit=10.2
5 test
When the download is complete
Enter the following commands respectively
Python
import torch
torch.cuda.is_available()

If you return true
It's a success
If you return flase Words
1 Check whether the graphics card driver has been updated
2 Reduce CUDA Version to download (10.2/10.0 etc. )
If you still fail, you can look at the following methods 2
\
Method 2:PIP download
Method 1 The previous steps remain unchanged
Reopen Anaconda Prompt Command window
I will delete the environment just created
1 Enter the following command
conda remove -n pytorch --all
1.1 establish pytorch Environmental Science
conda create -n pytorch python=3.8
1.2 Switch to pytorch Environmental Science
conda activate pytorch
(1.3 Switch to Tsinghua source
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
Because the method was created at one time .condarc The document is still there
So I won't operate here )
2 open pytorch Official website
1 First of all, we define our mission
Download the following three packages manually
pytorch torchvision torchaudio
We need to know the corresponding versions of these packages
torch==1.9.0+cu102
torchvision==0.10.0+cu102
torchaudio===0.9.0
2.1 Click on pip Download mode , Select the generated link to open in the browser

[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-cVbFETIv-1636987267070)(htts://img-blog.csdnimg.cn/b37b09033486441098093ab12d9102ac.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5a2Q55Sw5ZGA,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)]
2.2 Press ctrl+F Shortcut key search , Input torch-1.9.0%2B

%2B Yes, it is “+” It means cp38 yes c-python3.8 It means
2.3 Same as download win64 edition
torchvision==0.10.0+cu102
torchaudio===0.9.0
I save it directly to the user directory , Facilitate the following operations

2.4 Back to the command window
Input :dir
You can see these bags
torch torchaudio torchvision

2.5 Input :pip install torch Then press Tab Build automatic completion
pip install “torch-1.10.0+cu102-cp38-cp38-win_amd64.whl”
Enter to confirm the installation
2.6 pip install torchaudio Then press Tab Build automatic completion
Enter to confirm the installation
2.7 pip install torchvision Then press Tab Build automatic completion
Enter to confirm the installation
3 test
When the download is complete
Enter the following commands respectively
Python
Import torch
torch.cuda.is_available()

return true It was a success
\
Four : Next blog post
(1): download Pycharm
(2): Select the created pytorch Environment creation project
边栏推荐
- Are the top ten securities companies at great risk of opening accounts and safe and reliable?
- (翻译)采用字母间距提高全大写文本可读性的方式
- 浅谈Mysql底层索引原理
- WebGL谷歌提示内存不够(RuntimeError:memory access out of bounds,火狐提示索引超出界限(RuntimeError:index out of bounds)
- 《乔布斯传》英文原著重点词汇笔记(四)【 chapter two 】
- Matplotlib plt grid()
- 1、 Construction of single neural network
- Nodejs using the express framework demo
- Voiceprint Technology (II): Fundamentals of audio signal processing
- Chinese solution cannot be entered after webgl is published
猜你喜欢

C language: find all integers that can divide y and are odd numbers, and put them in the array indicated by B in the order from small to large

使用Navicat对比多环境数据库数据差异和结构差异,以及自动DML和DDL脚本

compiling stm32f4xx_it.c... “.\Objects\BH-F407.axf“ - 42 Error(s), 1 Warning(s).

C#启动程序传递参数丢失双引号,如何解决?

SQL高级

cazy長安戰役八卦迷宮

将jar包注册为服务,实现开机自动启动

The first techo day Tencent technology open day, 628 waiting for you!

Lvs-dr mode multi segment case

Unity发布webGL的时候JsonConvert.SerializeObject()转换失败
随机推荐
Close a thread
2、 Training fashion_ MNIST dataset
Oracle-单行函数大全
4、 Convolution neural networks
matplotlib matplotlib中axvline()和axhline()函数
三、自动终止训练
Is it safe for Huatai Securities to open a stock account on it?
《乔布斯传》英文原著重点词汇笔记(二)【 chapter one】
《JVM》对象内存分配的TLAB机制与G1中的TLAB流程
IC研发常用英文术语缩写
atguigu----01-脚手架
Voiceprint Technology (I): the past and present life of voiceprint Technology
socket编程——poll模型
ICer必须知道的35个网站
Matplotlib plt Axis() usage
cazy长安战役八卦迷宫
十大券商开户风险大吗,安全靠谱吗?
Atguigu---01-scaffold
Voiceprint Technology (IV): Engineering deployment of voiceprint recognition
Oracle one line function Encyclopedia