mahmoudnafifi / HistoGAN

Reference code for the paper HistoGAN: Controlling Colors of GAN-Generated and Real Images via Color Histograms (CVPR 2021).
MIT License
267 stars 27 forks source link

Runtime error: CUDA out of memory #23

Closed Edison12300 closed 2 years ago

Edison12300 commented 2 years ago

Hi, I've been trying to train your model with conda, but I keep run into an error saying that I don't have enough memory. Are there any solutions to this error? I've looked online, but there doesn't seem to be a way to fix this. I'm using CUDA 10.2 and pytorch 1.10.3. image Thanks!

mahmoudnafifi commented 2 years ago

That is either due to the network capacity or histogram computation. Try with a lower network capacity either by using lower image resolutions (--image_size) or reduce the entire network capacity from --network_capacity. To reduce memory use for histogram computations, you have several options: 1- reduce the maximum image size before computing the histogram feature (--hist_insz), 2- reduce histogram bins (--hist_bin), 3- or try another lighter histogram feature (e.g., rg-chromaticity) — this option wasn’t tested before but it may work on the same way of the uv-histogram feature. More details about histogram features implemented in this repo can be found here. Also check the colab example from the main page.

Edison12300 commented 2 years ago

Thanks! Reducing network capacity and histogram bins helps. It can run now. Thanks for the help!