PyTorch

What is PyTorch

An open source machine learning framework that accelerates the path from research prototyping to production deployment. It’s a Python-based scientific computing package targeted at two sets of audiences:

  • A replacement for NumPy to use the power of GPUs

  • a deep learning research platform that provides maximum flexibility and speed

How to Install

(2022.1 : Use Pytorch 1.10.x, CUDA=10.2)

Select your preferences and run the install command. Please ensure that you have met the prerequisites below (e.g., numpy)

https://pytorch.org/get-started/locally/

  • Install CUDA or check the installed GPU CUDA version

  • Install Anaconda: To install Anaconda, you will use the 64-bit graphical installer for Python 3.x.

  • Install Anaconda. After installation, run Anaconda Prompt

  • You can use previous virtual environment e.g. py37 , where other necessary tools are installed.

  • *(Optional) Make a new virtual environment e.g torch110.

    • For new virtual environment, In the (base) of Anaconda Prompt, create a new environment.

    • You need to install necessary tools again for this environment.

  • Install Python, Numpy, Panda and other prerequisite. Also, install necessary IDE (Jupyter Notebook, Visual Studio Code etc.)

Check Python version. Need to have Python 3.x on Windows. python --version

Check the list of packages installed in the environmentconda list

conda install pytorch torchvision cudatoolkit=10.2 -c pytorch

Verify installation

From the command line, type:

then enter the following code:

The output should be something similar to:

Additionally, to check if your GPU driver and CUDA is enabled and accessible by PyTorch, run the following commands to return whether or not the CUDA driver is enabled:

Last updated

Was this helpful?