Javier Perez Tobia
Javier Perez Tobia

Reputation: 77

RuntimeError: cuda runtime error (30) : unknown error at ..\aten\src\THC\THCGeneral.cpp:87

I have tried installing CUDA on Windows 10 to train nerual networks in my GPU(NVIDIA GeForce 710) but I get the following error when I tried to load an initial model.

Here's the code I am running:

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

device
"""# 1. Create the classifier"""

C = nn.Sequential(Flatten(), nn.Linear(784,200), nn.ReLU(), 
                            nn.Linear(200,100), nn.ReLU(),
                            nn.Linear(100,100), nn.ReLU(),
                            nn.Linear(100,10))

"""Upload the trained model"""

C.load_state_dict(torch.load("C.pt",map_location='cuda'))

And this is the error I am getting:

C.load_state_dict(torch.load("C.pt",map_location='cuda'))
Traceback (most recent call last):

  File "<ipython-input-2-358f76f483ed>", line 1, in <module>
    C.load_state_dict(torch.load("C.pt",map_location='cuda'))

  File "C:\Users\usuario\anaconda3\lib\site-packages\torch\serialization.py", line 368, in load
    return _load(f, map_location, pickle_module)

  File "C:\Users\usuario\anaconda3\lib\site-packages\torch\serialization.py", line 542, in _load
    result = unpickler.load()

  File "C:\Users\usuario\anaconda3\lib\site-packages\torch\serialization.py", line 505, in persistent_load
    data_type(size), location)

  File "C:\Users\usuario\anaconda3\lib\site-packages\torch\serialization.py", line 385, in restore_location
    return default_restore_location(storage, map_location)

  File "C:\Users\usuario\anaconda3\lib\site-packages\torch\serialization.py", line 114, in default_restore_location
    result = fn(storage, location)

  File "C:\Users\usuario\anaconda3\lib\site-packages\torch\serialization.py", line 96, in _cuda_deserialize
    return obj.cuda(device)

  File "C:\Users\usuario\anaconda3\lib\site-packages\torch\_utils.py", line 68, in _cuda
    with torch.cuda.device(device):

  File "C:\Users\usuario\anaconda3\lib\site-packages\torch\cuda\__init__.py", line 229, in __enter__
    _lazy_init()

  File "C:\Users\usuario\anaconda3\lib\site-packages\torch\cuda\__init__.py", line 162, in _lazy_init
    torch._C._cuda_init()

RuntimeError: cuda runtime error (30) : unknown error at ..\aten\src\THC\THCGeneral.cpp:87

I already installed cudNN and these are the versions I am using.

Python 3.7.6

CUDA 8.0

Pytorch 1.0.1

Upvotes: 0

Views: 4107

Answers (2)

Khan
Khan

Reputation: 1498

No need to restart PC. Juts paste these commands in command terminal and it the error will be removed.

sudo rmmod nvidia_uvm

sudo rmmod nvidia

sudo modprobe nvidia

sudo modprobe nvidia_uvm

Upvotes: 0

Gautamrk
Gautamrk

Reputation: 1244

Restarting your computer might fix the issue

reference

if it doesn't make sure that you

Re-install latest GPU driver

Reboot

Ensure you have admin access

Upvotes: 1

Related Questions