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

Out Of Memory #8

Open
erdog opened this issue Mar 17, 2020 · 13 comments
Open

Out Of Memory #8

erdog opened this issue Mar 17, 2020 · 13 comments

Comments

@erdog
Copy link

erdog commented Mar 17, 2020

Running zsm_my_video.sh. No matter what I do, I keep getting out of memory errors. I'm using an RTX 2060 with 16GB of system RAM and 6GB of dedicated GPU RAM. I'm running against a 1 second clip from a 480p video.

RuntimeError: CUDA out of memory. Tried to allocate 676.00 MiB (GPU 0; 6.00 GiB total capacity; 3.49 GiB already allocated; 662.13 MiB free; 3.66 GiB reserved in total by PyTorch) (malloc at ..\c10\cuda\CUDACachingAllocator.cpp:289)

@erdog
Copy link
Author

erdog commented Mar 17, 2020

Full stack trace

Traceback (most recent call last): File "video_to_zsm.py", line 131, in <module> main() File "video_to_zsm.py", line 110, in main output = single_forward(model, imgs_in) File "video_to_zsm.py", line 89, in single_forward model_output = model(imgs_temp) File "C:\Users\anon\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 532, in __call__ result = self.forward(*input, **kwargs) File "C:\Users\anon\Documents\Zooming-Slow-Mo-CVPR-2020\codes\models\modules\Sakuya_arch.py", line 336, in forward feats = self.ConvBLSTM(lstm_feats) File "C:\Users\anon\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 532, in __call__ result = self.forward(*input, **kwargs) File "C:\Users\anon\Documents\Zooming-Slow-Mo-CVPR-2020\codes\models\modules\Sakuya_arch.py", line 252, in forward out_fwd, _ = self.forward_net(x) File "C:\Users\anon\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 532, in __call__ result = self.forward(*input, **kwargs) File "C:\Users\anon\Documents\Zooming-Slow-Mo-CVPR-2020\codes\models\modules\Sakuya_arch.py", line 219, in forward h_temp = self.pcd_h(in_tensor, h) File "C:\Users\anon\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 532, in __call__ result = self.forward(*input, **kwargs) File "C:\Users\anon\Documents\Zooming-Slow-Mo-CVPR-2020\codes\models\modules\Sakuya_arch.py", line 157, in forward aligned_fea = self.pcd_align(fea1, fea2) File "C:\Users\anon\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 532, in __call__ result = self.forward(*input, **kwargs) File "C:\Users\anon\Documents\Zooming-Slow-Mo-CVPR-2020\codes\models\modules\Sakuya_arch.py", line 91, in forward L1_fea = self.L1_dcnpack_1(fea1[0], L1_offset) File "C:\Users\anon\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 532, in __call__ result = self.forward(*input, **kwargs) File "C:\Users\anon\Documents\Zooming-Slow-Mo-CVPR-2020\codes\models\modules\DCNv2\dcn_v2.py", line 140, in forward self.dilation, self.deformable_groups) File "C:\Users\anon\Documents\Zooming-Slow-Mo-CVPR-2020\codes\models\modules\DCNv2\dcn_v2.py", line 27, in forward ctx.dilation[1], ctx.deformable_groups) RuntimeError: CUDA out of memory. Tried to allocate 676.00 MiB (GPU 0; 6.00 GiB total capacity; 3.49 GiB already allocated; 662.13 MiB free; 3.66 GiB reserved in total by PyTorch) (malloc at ..\c10\cuda\CUDACachingAllocator.cpp:289) (no backtrace available)

@Mukosame
Copy link
Owner

Hi, you can edit zsm_my_video.sh and set "--N_out 7" to smaller numbers, like 3 or 5

@erdog
Copy link
Author

erdog commented Mar 17, 2020

Thanks for fast response. I did try that. I tried 3 and 5, same issue. What is the variable N_in used for? It doesnt appear to be used.

@erdog
Copy link
Author

erdog commented Mar 17, 2020

Using --N_out 3:

Traceback (most recent call last): File "video_to_zsm.py", line 131, in <module> main() File "video_to_zsm.py", line 110, in main output = single_forward(model, imgs_in) File "video_to_zsm.py", line 89, in single_forward model_output = model(imgs_temp) File "C:\Users\anon\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 532, in __call__ result = self.forward(*input, **kwargs) File "C:\Users\anon\Documents\Zooming-Slow-Mo-CVPR-2020\codes\models\modules\Sakuya_arch.py", line 342, in forward out = self.lrelu(self.pixel_shuffle(self.upconv2(out))) File "C:\Users\anon\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 532, in __call__ result = self.forward(*input, **kwargs) File "C:\Users\anon\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\anon\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 3.52 GiB (GPU 0; 6.00 GiB total capacity; 1.98 GiB already allocated; 1.70 GiB free; 2.60 GiB reserved in total by PyTorch)

@Mukosame
Copy link
Owner

Hi, please check this loc: https://github.com/Mukosame/Zooming-Slow-Mo-CVPR-2020/blob/master/codes/video_to_zsm.py#L23
I guess you need to try a smaller size of video for now. I'll try to solve it in the following updates.

@erdog
Copy link
Author

erdog commented Mar 17, 2020

Thanks. I'll try that.

@erdog
Copy link
Author

erdog commented Mar 18, 2020

Commenting out line out = self.lrelu(self.pixel_shuffle(self.upconv2(out))) in Sakuya_arch.py, and using N_out=3 allows a few new frames to be created before running out of memory.

@Mukosame
Copy link
Owner

Thanks for bringing this up. I think this can be fixed after I optimizing the workflow of test.py. I'll let you know as soon as I fix it!

@JadeWu233
Copy link

JadeWu233 commented Apr 18, 2020

Hi, I Commented out line out = self.lrelu(self.pixel_shuffle(self.upconv2(out))) in Sakuya_arch.py. Although no error will be reported, the output video and pictures will all turn blue. I do not recommend this.

@Namnodorel
Copy link

I have the same issue. I messed around a bit with zsm_my_video.py to make it load smaller batches of images into RAM at a time, but it still quickly runs out of dedicated GPU RAM.
My test video had a resolution of 432x236, but I have only 4GB dedicated and 16GB "normal" RAM available.

@NJ2020
Copy link

NJ2020 commented Jun 16, 2020 via email

@jiqirenno1
Copy link

Encounter the same problem,

Traceback (most recent call last):
  File "./video_to_zsm.py", line 126, in <module>
    main()
  File "./video_to_zsm.py", line 105, in main
    output = single_forward(model, imgs_in)
  File "./video_to_zsm.py", line 86, in single_forward
    model_output = model(imgs_temp)
  File "/home/ubuntu/miniconda3/envs/my/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "/media/ubuntu/6d2d0331-b42f-419a-b343-592105134c85/ubuntu/data/Prjpython/Zooming-Slow-Mo-CVPR-2020/codes/models/modules/Sakuya_arch.py", line 342, in forward
    out = self.lrelu(self.pixel_shuffle(self.upconv2(out)))
  File "/home/ubuntu/miniconda3/envs/my/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/ubuntu/miniconda3/envs/my/lib/python3.7/site-packages/torch/nn/modules/pixelshuffle.py", line 43, in forward
    return F.pixel_shuffle(input, self.upscale_factor)
RuntimeError: CUDA out of memory. Tried to allocate 2.64 GiB (GPU 0; 7.93 GiB total capacity; 4.13 GiB already allocated; 1.08 GiB free; 6.35 GiB reserved in total by PyTorch)

@Mukosame
Copy link
Owner

Mukosame commented Sep 5, 2021

The newest version should consume less memory and the CUDA memory.

@Mukosame Mukosame removed their assignment Sep 5, 2021
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

6 participants