facebookresearch/TransCoder

no CUDA-capable device is detected at /pytorch/aten/src/THC/THCGeneral.cpp

kchaksuvej opened this issue · 3 comments

I run translation using this command.

python translate.py --src_lang cpp --tgt_lang java --model_path model_1.pth < ADD_1_TO_A_GIVEN_NUMBER.cpp

I use VMware ubuntu 16.04. I got error:

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

How can I resolve this issue.?
Can I run it on vm machine ? Or I have to run on physical machine that has GPU installed.

Any installation document avaiable such as what version of OS, packages versions and etc.

Thanks

Hi,
Do you have at least one GPU on your machine ? Cuda needs at least one GPU to run. If you dont have one, you can adapt the notebook translate.py to make it run on CPU only. To do so, in translate.py replace '.cuda()' by '.cpu()' and add here the parameter device='cpu'. Translation on CPU works but it will be way slower.
If you do have a GPU, make sure it is free if not kill the process running on it. Then, if you still have the issue, you should contact Pytorch team directly https://github.com/pytorch/pytorch .

Thanks

A bit more: To make this work (in addition to the advice above) I had to change the device parameter in the translate function in translate.py to device='cpu'. I also had to replace .cuda() to .cpu() in /XLM/src/model/__init__py.

And make sure that you have a non-GPU version of pytorch.