Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: CUDA error: out of memory #17

Open
akhilvinvent opened this issue Aug 20, 2019 · 1 comment
Open

RuntimeError: CUDA error: out of memory #17

akhilvinvent opened this issue Aug 20, 2019 · 1 comment

Comments

@akhilvinvent
Copy link

I am facing issue RuntimeError: CUDA error: out of memory.
I had follow the instructions.

Traceback (most recent call last):
File "test_GFN_4x.py", line 130, in
model_test(model)
File "test_GFN_4x.py", line 100, in model_test
test(testloader, model, criterion, SR_dir)
File "test_GFN_4x.py", line 77, in test
[lr_deblur, sr] = model(LR_Blur, gated_Tensor, test_Tensor)
File "D:\InstalledApps\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "D:\Work\VInventTechWork\Biop.ai\Deblurry\GFN\networks\GFN_4x.py", line 216, in forward
recon_out = self.reconstructMoudle(fusion_feature)
File "D:\InstalledApps\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "D:\InstalledApps\Anaconda3\lib\site-packages\torch\nn\modules\container.py", line 91, in forward
input = module(input)
File "D:\InstalledApps\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "D:\Work\VInventTechWork\Biop.ai\Deblurry\GFN\networks\GFN_4x.py", line 186, in forward
pixelshuffle1 = self.relu1(self.pixelShuffle1(con1))
File "D:\InstalledApps\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "D:\InstalledApps\Anaconda3\lib\site-packages\torch\nn\modules\pixelshuffle.py", line 40, in forward
return F.pixel_shuffle(input, self.upscale_factor)
File "D:\InstalledApps\Anaconda3\lib\site-packages\torch\nn\functional.py", line 1844, in pixel_shuffle
shuffle_out = input_view.permute(0, 1, 4, 2, 5, 3).contiguous()
RuntimeError: CUDA error: out of memory

@Booooooooooo
Copy link

I have found that in

epoch_loss += mse

epoch_loss += mse will accumulate gradients of all iterations and finally cause CUDA out of memory.
Use epoch_loss += mse.item() instead will solve this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants