I can run the Jupyter notebook version of this without any issues but the version gives me an error:

Found GPU0 NVS 4200M which is of cuda capability 2.1.
PyTorch no longer supports this GPU because it is too old.

warnings.warn(old_gpu_warn % (d, name, major, capability[1]))
Traceback (most recent call last):
File “/media/nobu/Ubuntu Backup/Comp Sci/_DeepLearning/pytorch/”, line 460, in
state = current_screen - last_screen
RuntimeError: CUDA error: no kernel image is available for execution on the device

Process finished with exit code 1

Your GPU is quite old by now and the PyTorch binaries do not ship CUDA with the necessary compute capability. If you really want to use this GPU, you could try to build from source as described here. However, as far as I can tell your GPU should only have ~1GB of memory besides a probably low performance.


So how do I just edit the code so that it uses CPU?



At the beginning of the code just set device = 'cpu'.

Thanks bro! I’m sorry for the lazy nature of my question but you pytorch guys seem so much cooler than the tensorflow ones:)

1 Like