Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pytorch version for cuda 12.2

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

like image 652
anarghya s r Avatar asked Sep 12 '25 08:09

anarghya s r


2 Answers

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

like image 193
Matt Avatar answered Sep 14 '25 00:09

Matt


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

like image 43
Rakshan Sharma Avatar answered Sep 13 '25 22:09

Rakshan Sharma