Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build Pytorch Development Environment

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you how to build a Pytorch development environment, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Brief introduction of Software and hardware Environment windows 10 64bitcuda 10.1pytorch 1.6anaconda with python 3.7nvidia geforce 1660

At present, there are many deep learning frameworks, such as Tensorflow, Pytorch, Keras, FastAI, CNTK and so on. These frameworks have their own advantages and disadvantages, especially Tensorflow and Pytorch, which are widely used, so how to choose? This should be a puzzling problem for every child who is about to begin to learn in-depth learning. Let's first take a look at a usage statistics of various frameworks on github

Several reasons why pytorch chose pytorch

Dynamic calculation diagram

The usage is closer to python and easier to use than tensorflow.

Helps to understand the core of deep learning

Pytorch needs to define the network layer, update parameters and other steps, which can help us to deeply understand deep learning.

Dynamic graph mechanism

Dynamic graph mechanism is very convenient in debugging.

Easy to use

Get started quickly, and it's easy to switch to other frames after learning.

Install the python environment

Here we use anaconda this integrated environment, about anaconda, we have already introduced the previous https://xugaoxiang.com/2019/12/08/anaconda/, do not understand the children's shoes can go to see. With the python environment, let's next create a virtual environment designed specifically for using pytorch

Conda create-n pytorch2.6 python=3.7

Conda activate pytorch2.6

Install the nvidia driver

Go to nvidia official website https://www.nvidia.cn/Download/index.aspx?lang=cn to download driver files.

Pytorch

After downloading the installation file, install it foolishly, and finally confirm whether the installation is successful. Open Task Manager-- > performance-- > GPU 0

Pytorch install pytorch

When you come to the official website https://pytorch.org/get-started/locally/, choose PyTorch Build as the stable version 1.6.0, windows as the operating system, pip for Package, Python for Language, CUDA for 10.1, all of which need to be selected according to your actual situation. As you can see, we didn't install CUDA separately in the previous step, because CUDA was installed by the way during the installation of pytorch, which is great.

Pytorchpip install torch==1.6.0+cu101 torchvision==0.7.0+cu101-f https://download.pytorch.org/whl/torch_stable.html

If there is no GPU environment, the installation command is

Pip install torch==1.6.0+cpu torchvision==0.7.0+cpu-f https://download.pytorch.org/whl/torch_stable.html

Verify the pytorch environment (pytorch2.6) PS C:\ Windows\ system32 > python

Python 3.7.9 (default, Aug 31 2020, 17:10:11) [MSC v.1916 64 bit (AMD64)]:: Anaconda, Inc. On win32

Type "help", "copyright", "credits" or "license" for more information.

> import torch

> torch.__version__

'1.6.0 cu101'

> > torch.cuda.is_available ()

True

> > >

In addition, you can use the nvidia-smi command to see how the current process is using GPU resources

The above content of pytorch is how to build a Pytorch development environment. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report