KAIR icon indicating copy to clipboard operation
KAIR copied to clipboard

Excessive memory usage usrnet

Open jofuelo opened this issue 3 years ago • 1 comments

I'm testing usrgan and I'm surprised that I'm not able to apply it to a 750x1000 px image, considering that the model has only 17016016 parameters. The error is CUDA out of memory and my graphic card has 8GB of memory. I have also tested it on a 11GB 1080Ti and the error still happens. Can someone test it and shed some light on this matter?

I'm pasting the full traceback here:

Traceback (most recent call last): File "main_test_usrnet.py", line 236, in main() File "main_test_usrnet.py", line 190, in main x = model(x, k, sf, sigma) File "C:\Users\usrname\anaconda3\envs\tensor\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "D:\Desktop\KAIR-master\models\network_usrnet.py", line 342, in forward x = self.p(torch.cat((x, ab[:, i+self.n:i+self.n+1, ...].repeat(1, 1, x.size(2), x.size(3))), dim=1)) File "C:\Users\usrname\anaconda3\envs\tensor\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "D:\Desktop\KAIR-master\models\network_usrnet.py", line 237, in forward x2 = self.m_down1(x1) File "C:\Users\usrname\anaconda3\envs\tensor\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "C:\Users\usrname\anaconda3\envs\tensor\lib\site-packages\torch\nn\modules\container.py", line 117, in forward input = module(input) File "C:\Users\usrname\anaconda3\envs\tensor\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "D:\Desktop\KAIR-master\models\basicblock.py", line 222, in forward res = self.res(x) File "C:\Users\usrname\anaconda3\envs\tensor\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "C:\Users\usrname\anaconda3\envs\tensor\lib\site-packages\torch\nn\modules\container.py", line 117, in forward input = module(input) File "C:\Users\usrname\anaconda3\envs\tensor\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "C:\Users\usrname\anaconda3\envs\tensor\lib\site-packages\torch\nn\modules\conv.py", line 419, in forward return self._conv_forward(input, self.weight) File "C:\Users\usrname\anaconda3\envs\tensor\lib\site-packages\torch\nn\modules\conv.py", line 416, in _conv_forward self.padding, self.dilation, self.groups) RuntimeError: CUDA out of memory. Tried to allocate 2.86 GiB (GPU 0; 8.00 GiB total capacity; 4.10 GiB already allocated; 1.88 GiB free; 4.43 GiB reserved in total by PyTorch)

jofuelo avatar Apr 02 '21 11:04 jofuelo

Hi, dude, I encountered the same problem last night. I just alter the attribution in json file and it work ! You can also try to decrease the value of ”dataloader_batch_size“.

Gwiths avatar Apr 03 '21 03:04 Gwiths