pytorch-CycleGAN-and-pix2pix icon indicating copy to clipboard operation
pytorch-CycleGAN-and-pix2pix copied to clipboard

CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 1.96 GiB total capacity; 1.07 GiB already allocated; 12.50 MiB free; 135.23 MiB cached)

Open rachitagrwl opened this issue 5 years ago • 8 comments

Hi,

Please guide me solve this issue. I am just following your Github steps to run it successfully.

rachitagrwl avatar Jul 02 '19 20:07 rachitagrwl

The program requires more than 2 GB GPU. It seems that your GPU has 2 GB, which is not sufficient to run the program.

junyanz avatar Jul 04 '19 15:07 junyanz

I ran it with load_size 128 - I know this will very less frame size. But a quick question is it worth to do that efforts.?

rachitagrwl avatar Jul 04 '19 15:07 rachitagrwl

If you use CycleGAN, it will require more than 2GB even with load_size 128.

junyanz avatar Jul 04 '19 15:07 junyanz

Okay, any way to compute/hack around to computer over it.?

rachitagrwl avatar Jul 04 '19 15:07 rachitagrwl

I am not aware. You can also use GPU cloud service if you don't want to buy a new GPU.

junyanz avatar Jul 04 '19 15:07 junyanz

Hi, I have a similar error. RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 10.76 GiB total capacity; 2.42 GiB already allocated; 26.12 MiB free; 2.75 GiB reserved in total by PyTorch). Is that GPU also too small?

TavRotenberg avatar Mar 22 '20 06:03 TavRotenberg

@TavRotenberg It depends on the input image size. There are chances that other processes are utilizing the gpu memory as well. Please clear it and just use the preprocess flag as --preprocess resize and crop and try to run now. Hope it helps

kalai2033 avatar Apr 22 '20 10:04 kalai2033

For anyone that finds themselves contending with this issue, --crop_size is the specific parameter that allowed me to train the CycleGAN model without bumping into a memory issue. Modified from the default 256 to 128. Training and testing results look reasonable.

ccfarah avatar Aug 07 '22 01:08 ccfarah

+1. please refer to training & test tips for high-res model training.

junyanz avatar Oct 04 '22 20:10 junyanz