Page 1 of 1

Ich kann es nicht schaffen, Pytorch mit GPU auszuführen

Posted: 10 Feb 2025, 13:03
by Anonymous
Jeder! Ich habe ein Problem - ich versuche, Pytorch auf der GPU laufen zu lassen, aber ich habe keinen Erfolg. Aber Python gibt immer noch aus, die kein Cuda gefunden hat. Was könnte ich noch tun?

Code: Select all

import torch

print(f"Is CUDA supported by this system?{torch.cuda.is_available()}")
print(f"CUDA version: {torch.version.cuda}")

# Storing ID of current CUDA device
cuda_id = torch.cuda.current_device()
print(f"ID of current CUDA device:{torch.cuda.current_device()}")

print(f"Name of current CUDA device:{torch.cuda.get_device_name(cuda_id)}")`
< /code>
und erhalten Sie weiterhin diese Antwort: < /p>
C:\\Users\\Valen\\PycharmProjects\\godhelpme.venv\\Scripts\\python.exe "D:\\Programming shit\\godhelpme\\torchtest.py"
Traceback (most recent call last):
File "D:\\Programming shit\\godhelpme\\torchtest.py", line 7, in \
cuda_id = torch.cuda.current_device()
File "C:\\Users\\Valen\\PycharmProjects\\godhelpme.venv\\Lib\\site-packages\\torch\\cuda\__init_\_.py", line 971, in current_device
_lazy_init()
\~\~\~\~\~\~\~\~\~\~^^
File "C:\\Users\\Valen\\PycharmProjects\\godhelpme.venv\\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
Is CUDA supported by this system?False
CUDA version: None

Process finished with exit code 1