RuntimeError: cuda runtime error (100) : no CUDA-capable device is detected at ..\aten\src\THC\THCGeneral.cpp:50

I was trying to run the extractive summarizer of the BERTSUM program( in test mode with the following command:

python -task ext -mode test -batch_size 3000 -test_batch_size 500 -bert_data_path C:\Users\hp\Downloads\PreSumm-master\PreSumm-master\bert_data -log_file ../logs/val_abs_bert_cnndm -model_path C:\Users\hp\Downloads\bertext_cnndm_transformer -test_from C:\Users\hp\Downloads\bertext_cnndm_transformer\ -sep_optim true -use_interval true -visible_gpus 1 -max_pos 512 -max_length 200 -alpha 0.95 -min_length 50 -result_path ../logs/abs_bert_cnndm

Here is the error log:

[2020-01-13 21:03:01,681 INFO] loading weights file from cache at ../temp\aa1ef1aede4482d0dbcd4d52baad8ae300e60902e88fcb0bebdec09afd232066.36ca03ab34a1a5d5fa7bc3d03d55c4fa650fed07220e2eeebc06ce58d0e9a157
driver version : 10020
THCudaCheck FAIL file=..\aten\src\THC\THCGeneral.cpp line=50 error=100 : no CUDA-capable device is detected
Traceback (most recent call last):
  File "", line 156, in <module>
    test_ext(args, device_id, cp, step)
  File "C:\Users\hp\Downloads\PreSumm-master\PreSumm-master\src\", line 190, in test_ext
    model = ExtSummarizer(args, device, checkpoint)
  File "C:\Users\hp\Downloads\PreSumm-master\PreSumm-master\src\models\", line 168, in __init__
  File "C:\Users\hp\Anaconda3\lib\site-packages\torch\nn\modules\", line 426, in to
    return self._apply(convert)
  File "C:\Users\hp\Anaconda3\lib\site-packages\torch\nn\modules\", line 202, in _apply
  File "C:\Users\hp\Anaconda3\lib\site-packages\torch\nn\modules\", line 202, in _apply
  File "C:\Users\hp\Anaconda3\lib\site-packages\torch\nn\modules\", line 202, in _apply
  [Previous line repeated 1 more time]
  File "C:\Users\hp\Anaconda3\lib\site-packages\torch\nn\modules\", line 224, in _apply
    param_applied = fn(param)
  File "C:\Users\hp\Anaconda3\lib\site-packages\torch\nn\modules\", line 424, in convert
    return, dtype if t.is_floating_point() else None, non_blocking)
  File "C:\Users\hp\Anaconda3\lib\site-packages\torch\cuda\", line 194, in _lazy_init
RuntimeError: cuda runtime error (100) : no CUDA-capable device is detected at ..\aten\src\THC\THCGeneral.cpp:50

I am sure that I have a CUDA-enabled GPU, I made sure by checking the list on NVIDIA. This is an NVIDIA GeForce GTX 950M. I have also used my GPU for deep learning projects with CUDA before. I have installed CUDA and cudNN following these instructions, thinking that could be the problem: versions, CUDA 10.2). I also tried adding os.environ[‘CUDA_VISIBLE_DEVICES’]=‘0’ in this worked for people facing the same kind of error from help posts online). But still the error persists.

I’d really appreciate if someone could help me figure this out.

How did you install PyTorch?
If you’ve installed the binaries, note that they will ship with their own CUDA, cudnn etc., so you don’t need to install these libraries locally unless you want to build from source or CUDA extensions.

Could you post the install log, please?
Were you able to use PyTorch with this GPU before?

@ptrblck, thank you for the response. I remember I had installed PyTorch with conda. Around that time, I had done a pip install for a different version of torch. But ‘conda list torch’ gives me the current global version as 1.3.0.

Also, ‘conda list cuda’ returns this:

# packages in environment at C:\Users\hp\Anaconda3:
# Name                    Version                   Build  Channel
cuda100                   1.0                           0    pytorch
cudatoolkit               10.1.168                      0

I also recently installed CUDA 10.2, and cudnn with it globally.

I have used torch on my system for DL before. But I am confused now, as to whether all of the training in my DL projects was actually being done by CPU and not my GPU(I know it sounds really funny, but I seemed sure it was my GPU, because the training was quite quick). Is there any way I can check my GPU history?

When I went through my previous jupyter notebooks(not run from any virtual env), I found this:

And then I ran this code on my system yesterday:

import torch 



driver version : 10020
<torch.cuda.device object at 0x0000028603786FD0>
GeForce GTX 950M

This seems contradicting to me(how the jupyter notebook says that CUDA is not available, and how the cmd program says that CUDA is available).

I guess the Python kernel / environment in your Jupyter notebook might not be the same you are using in your terminal by running python
Could create a (new) conda environment and execute the notebook as well as run your script in this env?