xinntao / ESRGAN

ECCV18 Workshops - Enhanced SRGAN. Champion PIRM Challenge on Perceptual Super-Resolution. The training codes are in BasicSR.
https://github.com/xinntao/BasicSR
Apache License 2.0
6.04k stars 1.07k forks source link

ESRGAN Doesn't run on GPU "RuntimeError: error in LoadLibraryA" #94

Closed Masterbond7 closed 3 years ago

Masterbond7 commented 4 years ago

Sorry, I am new to CUDA and things like this but every time I want to run ESRGAN on my GPU it gives me this error. Works fine on CPU.

Full output: ============================== RESTART: C:\Users\Masterbond7\Desktop\ESRGAN-master\test.py ============================= Model path models/RRDB_ESRGAN_x4.pth. Testing... 1 baboon Traceback (most recent call last): File "C:\Users\Masterbond7\Desktop\ESRGAN-master\test.py", line 34, in output = model(imgLR).data.squeeze().float().cpu().clamp(0, 1).numpy() File "C:\Users\Masterbond7\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 532, in call result = self.forward(*input, kwargs) File "C:\Users\Masterbond7\Desktop\ESRGAN-master\RRDBNet_arch.py", line 71, in forward trunk = self.trunk_conv(self.RRDB_trunk(fea)) File "C:\Users\Masterbond7\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 532, in call result = self.forward(*input, *kwargs) File "C:\Users\Masterbond7\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\container.py", line 100, in forward input = module(input) File "C:\Users\Masterbond7\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 532, in call result = self.forward(input, kwargs) File "C:\Users\Masterbond7\Desktop\ESRGAN-master\RRDBNet_arch.py", line 47, in forward out = self.RDB1(x) File "C:\Users\Masterbond7\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 532, in call result = self.forward(*input, **kwargs) File "C:\Users\Masterbond7\Desktop\ESRGAN-master\RRDBNet_arch.py", line 30, in forward x2 = self.lrelu(self.conv2(torch.cat((x, x1), 1))) RuntimeError: error in LoadLibraryA

rustemsadrl commented 4 years ago

You're probably running the latest version of Python. I had the same error until I downgraded to Python 3.7.5 and now it works.

rlaphoenix commented 4 years ago

You're probably running the latest version of Python. I had the same error until I downgraded to Python 3.7.5 and now it works.

Python 3.8.1 on latest CUDA and latest NVIDIA drivers works for me. I'm on arch linux with everything up to date.

autofasurer commented 4 years ago

Put this after importing torch:

import ctypes
ctypes.cdll.LoadLibrary('caffe2_nvrtc.dll')
Dhawaleswrar commented 4 years ago

Put this after importing torch:

import ctypes
ctypes.cdll.LoadLibrary('caffe2_nvrtc.dll')

It's working now..Thank you..