Can I use PyTorch without a CUDA gpu?

I’ve read elsewhere that you can run PyTorch on a cpu, but I’m trying to run a random library (that uses PyTorch) I found on github. So, I’m unsure all the necessary changes I would need to make in order to make it compatible with a cpu.

The issue I’m running into is that when torch is called, it starts by trying to call the dlopen() function for some DLL files. That’s where the program ends with the error below. I think it’s b/c I don’t have an nvidia card, but I’m not sure as I’m new to PyTorch.

File “C:\Users*\Desktop\VIP*\venv\lib\site-packages\pytorch_lightning_init_.py”, line 28, in
from .trainer.trainer import Trainer
File “C:\Users*\Desktop\VIP*\venv\lib\site-packages\pytorch_lightning\trainer\trainer.py”, line 9, in
import torch
File “C:\Users*\Desktop\VIP*\venv\lib\site-packages\torch_init_.py”, line 81, in
ctypes.CDLL(dll)
File “C:\Users*\Anaconda3\envs*\lib\ctypes_init_.py”, line 364, in init
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found

You do not need an NVIDIA GPU to use PyTorch, unless the workload you are running has operations that are only implemented for CUDA devices (e.g., a custom CUDA extension). How did you install PyTorch? It might be worth validating that the install itself is functioning properly before trying a PyTorch Lightning workload.

Hi, Eqy. Thank you for replying.

So my install wasn’t as easy as “pip install torch==1.5.0”. When I used that, I got an error saying pip couldn’t find that version and that it only has versions 1.7.0+. So I had to pip it from https://download.pytorch.org/whl/torch_stable.html along with torchvision==0.6.0.

But when I run the program at the command line (using the authors instructions), it says that some DLL modules could not be found. That was when the program was calling the init.py file for the torch module. I was getting lost beyond that though.

How can I validate the install was clean?

Note that 1.5.0 is a very old version at this point. Is there a reason that you need it in particular rather than a newer version?

I would start by trying simple operations and examples in PyTorch and seeing that they execute without errors to validate your install.

I’m actually trying to run a library I found on github that makes use of pytorch. Its requirements require this version. Should I just try a newer version of torch and hope for the best (or I guess worst too would be just to reconfigure the necessary parts of the library). I honestly think it’s related to my GPU though.

My intuition is that this looks tricky as from your directory paths I assume you are on a WSL/WSL2 system. My experience is that more recent versions of PyTorch + WSL2 have greatly improved support so I would try a newer version if possible.

I’ll give that a shot and reach back out here if I run into more problems. Thanks!