Pytorch version for cuda 12.2
Asked Answered
A

5

19

I am unable to find the Pytorch version for cuda driver 12.2. Can anyone please guide me where can I find any material that helps.

I have installed currently pytorch version 11.7. While training the model i am facing following error.

** RuntimeError(CUDA_MISMATCH_MESSAGE.format(cuda_str_version, torch.version.cuda)

The detected CUDA version (12.2) mismatches the version that was used to compile PyTorch (11.7). Please make sure to use the same CUDA versions.**

PS : I have nvidia driver 535

Thanks in advance

Alforja answered 13/7, 2023 at 11:26 Comment(0)
S
7

You can install the nightly build. Note you should have cudnn installed already, I am using cudnn v8.9.3. The 12.1 PyTorch version works fine with CUDA v12.2.2:

conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch-nightly -c nvidia

Sadler answered 26/9, 2023 at 19:3 Comment(0)
N
6

I am having the same issue. It appears that the PyTorch version for CUDA 12.2 is not out yet.

Here are the few options I am currently exploring. Still haven't decided which one I'll end up using:

  1. Using an NGC Container
    https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch
    This is essentially like a virtual environment with the required CUDA drivers and everything included.

  2. Downgrading to CUDA 12.1 and installing the nightly version
    https://download.pytorch.org/whl/nightly/cu121
    Not sure exactly the driver version I would need for this but it could be a viable option.

  3. Just waiting and hoping they release it soon

  4. (Most Likely) I will just build it from the source. https://github.com/pytorch/pytorch/issues/104417

References
https://discuss.pytorch.org/t/which-version-of-cuda-12-1-should-be-used/176456 https://discuss.pytorch.org/t/pytorch-for-cuda-12/169447/2

Newtonnext answered 20/7, 2023 at 18:17 Comment(0)
S
4

With python 3.10, NVIDIA driver version 535.104.05 and CUDA version 12.2 I found that this works: conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia

Specie answered 27/9, 2023 at 7:5 Comment(0)
T
1

I had a similar issue of Torch not compiled with CUDA enabled. Here are the steps I took:

  1. Created a new conda environment

    conda create -n newenv python=3.10

    conda activate newenv

  2. Installed pytorch-nightly

    conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch-nightly -c nvidia

  3. Check if the CUDA is compatible with the installed PyTorch by running

    import torch

    print(torch.cuda.is_available())

It would return True if the CUDA is configured properly.

Tc answered 4/12, 2023 at 20:46 Comment(0)
P
-4

If you are using Llama-2, I think you need to downgrade Nvida CUDA from 12.2 to 10.2. Version 10.2 is the most stable version. Pytorch version 1.5 works with Pytorch for CUDA 10.2. However, the problem I have is it seems Anaconda keeps downloading the CPU libaries in Pytorch rather than the GPU. Not sure why.

Procryptic answered 8/8, 2023 at 4:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.