neural-style-pt icon indicating copy to clipboard operation
neural-style-pt copied to clipboard

Error, But Only When Certain Image Combos Are Used

Open spot92 opened this issue 4 years ago • 3 comments

I get the following error, but only when using specific image combinations. I can use the content with other styles or style with other content. Very confusing.

Traceback (most recent call last): File "D:\Neural Style Python\style_transfer_GUI.py", line 513, in main() File "D:\Neural Style Python\style_transfer_GUI.py", line 306, in main optimizer.step(feval) File "C:\Users\levic\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\optim\lbfgs.py", line 307, in step orig_loss = closure() File "D:\Neural Style Python\style_transfer_GUI.py", line 286, in feval net(img) File "C:\Users\levic\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 541, in call result = self.forward(*input, **kwargs) File "C:\Users\levic\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\container.py", line 92, in forward input = module(input) File "C:\Users\levic\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 541, in call result = self.forward(*input, **kwargs) File "C:\Users\levic\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\conv.py", line 345, in forward return self.conv2d_forward(input, self.weight) File "C:\Users\levic\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\conv.py", line 342, in conv2d_forward self.padding, self.dilation, self.groups) RuntimeError: CUDA out of memory. Tried to allocate 8.16 GiB (GPU 0; 11.00 GiB total capacity; 439.38 MiB already allocated; 8.16 GiB free; 126.62 MiB cached)

spot92 avatar Jun 16 '20 21:06 spot92

@spot92 I need more information to know if it's a neural-style-pt issue or a PyTorch/CUDA issue. If it's a PyTorch issue with the latest update, then trying to to simplify the code for reproducing the error will help their devs solve it.

Also, do any of the fixes in these issues solve things?

https://github.com/pytorch/pytorch/issues/16417

https://discuss.pytorch.org/t/runtimeerror-cuda-out-of-memory-tried-to-allocate-1-12-mib-gpu-0-11-91-gib-total-capacity-5-52-gib-already-allocated-2-06-mib-free-184-00-kib-cached/42080/9

https://www.kaggle.com/c/jigsaw-unintended-bias-in-toxicity-classification/discussion/91081

ProGamerGov avatar Jun 16 '20 21:06 ProGamerGov

I'll look into them. I just thought it was weird that it only did it with specific combinations of images. Thanks!

spot92 avatar Jun 16 '20 21:06 spot92

Looks like the Geforce limitation on the usable memory, about 70% of VRAM in Linux with Pytorch (1 GPU). Image max size depends on the framework and option, try to reduce it.

sawtl avatar Aug 31 '20 09:08 sawtl