Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use GPU with NeuralMemory, error message Torch not compiled with CUDA enabled #9

Open
Fomalhaut-AST opened this issue Jan 21, 2025 · 3 comments

Comments

@Fomalhaut-AST
Copy link

I followed the installation steps and executed the titans-pytorch code, but encountered the following error:
Traceback (most recent call last): File "D:\User\Documents\SR\Titan\titans-pytorch-main\test.py", line 8, in <module> ).cuda() File "D:\ProgramSoftware\anaconda3\envs\titan\lib\site-packages\torch\nn\modules\module.py", line 1050, in cuda return self._apply(lambda t: t.cuda(device)) File "D:\ProgramSoftware\anaconda3\envs\titan\lib\site-packages\torch\nn\modules\module.py", line 900, in _apply module._apply(fn) File "D:\ProgramSoftware\anaconda3\envs\titan\lib\site-packages\torch\nn\modules\module.py", line 927, in _apply param_applied = fn(param) File "D:\ProgramSoftware\anaconda3\envs\titan\lib\site-packages\torch\cuda\__init__.py", line 310, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled
The code fails with the error: AssertionError: Torch not compiled with CUDA enabled.
It seems that the PyTorch version installed is the CPU version, and it's not compiled with CUDA support. I would appreciate guidance on how to properly configure the environment for GPU usage, or if there is a recommended version of PyTorch to install that includes CUDA support.

@maxzuo
Copy link

maxzuo commented Jan 21, 2025

https://pytorch.org/get-started/locally/ seems like a good place to start; this doesn't seem like it's related to this project imo.

@cr4yfish
Copy link

Had the same issue. This fixed it for me

pip uninstall torch
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Source: https://stackoverflow.com/questions/75752503/error-torch-not-compiled-with-cuda-enabled

@Fomalhaut-AST
Copy link
Author

Fomalhaut-AST commented Jan 26, 2025

Had the same issue. This fixed it for me

pip uninstall torch
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
Source: https://stackoverflow.com/questions/75752503/error-torch-not-compiled-with-cuda-enabled

Thanks! My solution is to not use the pip install command provided in the code, but instead manually install PyTorch first and then manually install each package based on the program in the source code. That works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants