Tuesday, December 26, 2023

How to Install Torch With Cuda in GPU Windows

How to install Torch With Cuda in GPU Windows

To know previous version of pytorch = https://pytorch.org/get-started/previous-versions/ 

(jupyter) F:\PYTHON\jupyter>pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu121

Looking in indexes: https://download.pytorch.org/whl/cu121

Collecting torch==2.1.1

  Downloading https://download.pytorch.org/whl/cu121/torch-2.1.1%2Bcu121-cp311-cp311-win_amd64.whl (2473.9 MB)

     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.5/2.5 GB 1.2 MB/s eta 0:00:00

Collecting torchvision==0.16.1

  Downloading https://download.pytorch.org/whl/cu121/torchvision-0.16.1%2Bcu121-cp311-cp311-win_amd64.whl (5.6 MB)

     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.6/5.6 MB 2.4 MB/s eta 0:00:00

Collecting torchaudio==2.1.1

  Downloading https://download.pytorch.org/whl/cu121/torchaudio-2.1.1%2Bcu121-cp311-cp311-win_amd64.whl (4.0 MB)

     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.0/4.0 MB 4.4 MB/s eta 0:00:00

Requirement already satisfied: filelock in f:\python\jupyter\lib\site-packages (from torch==2.1.1) (3.13.1)

Requirement already satisfied: typing-extensions in f:\python\jupyter\lib\site-packages (from torch==2.1.1) (4.5.0)

Requirement already satisfied: sympy in f:\python\jupyter\lib\site-packages (from torch==2.1.1) (1.12)

Requirement already satisfied: networkx in f:\python\jupyter\lib\site-packages (from torch==2.1.1) (3.2.1)

Requirement already satisfied: jinja2 in f:\python\jupyter\lib\site-packages (from torch==2.1.1) (3.1.2)

Requirement already satisfied: fsspec in f:\python\jupyter\lib\site-packages (from torch==2.1.1) (2023.12.2)

Requirement already satisfied: numpy in f:\python\jupyter\lib\site-packages (from torchvision==0.16.1) (1.23.5)

Requirement already satisfied: requests in f:\python\jupyter\lib\site-packages (from torchvision==0.16.1) (2.31.0)

Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in f:\python\jupyter\lib\site-packages (from torchvision==0.16.1) (10.1.0)

Requirement already satisfied: MarkupSafe>=2.0 in f:\python\jupyter\lib\site-packages (from jinja2->torch==2.1.1) (2.1.3)

Requirement already satisfied: charset-normalizer<4,>=2 in f:\python\jupyter\lib\site-packages (from requests->torchvision==0.16.1) (3.3.2)

Requirement already satisfied: idna<4,>=2.5 in f:\python\jupyter\lib\site-packages (from requests->torchvision==0.16.1) (3.6)

Requirement already satisfied: urllib3<3,>=1.21.1 in f:\python\jupyter\lib\site-packages (from requests->torchvision==0.16.1) (2.1.0)

Requirement already satisfied: certifi>=2017.4.17 in f:\python\jupyter\lib\site-packages (from requests->torchvision==0.16.1) (2023.11.17)

Requirement already satisfied: mpmath>=0.19 in f:\python\jupyter\lib\site-packages (from sympy->torch==2.1.1) (1.3.0)

Installing collected packages: torch, torchvision, torchaudio

  Attempting uninstall: torch

    Found existing installation: torch 2.1.2

    Uninstalling torch-2.1.2:

      Successfully uninstalled torch-2.1.2

Successfully installed torch-2.1.1+cu121 torchaudio-2.1.1+cu121 torchvision-0.16.1+cu121


(jupyter) F:\PYTHON\jupyter>python -c "import torch; print(torch.rand(2,3).cuda())"

tensor([[0.2774, 0.4768, 0.9545],

        [0.7738, 0.6247, 0.4539]], device='cuda:0')


(jupyter) F:\PYTHON\jupyter>python -c "import torch; print(torch.cuda.device_count())"

1






No comments:

Post a Comment