junyanz / CycleGAN

Software that can generate photos from paintings, turn horses into zebras, perform style transfer, and more.
Other
12.23k stars 1.93k forks source link

A pair of 256x256 images and I am already out of memory? #91

Closed inkplay closed 6 years ago

inkplay commented 6 years ago

Just downloaded the zip and ran it in python. I picked 2 images for style transfer and I have put them separately in trainA and trainB in another folder called style. I did not make valA and valB folders. I called:

python train.py --dataroot ./datasets/style

everything runs until it hits x + self.conv_block(x) which is part of the residual layer then I get cuda error on running out of memory? GPUs = 2 GTX 980 with 3GB in each so 6GB in total. In the printed info below it shows that I have 11.378 million params. What did I do wrong? Do I need to lower my residual blocks and change the default epoch size?

Edited: Btw how do you calculate param size anways? How big is 11M param in memory?

CustomDatasetDataLoader

dataset [UnalignedDataset] was created

#training images = 1

C:\Users\name\Desktop\Painter\models\networks.py:45: UserWarning: nn.init.normal is now 

deprecated in favor of nn.init.normal_.

  init.normal(m.weight.data, 0.0, 0.02)

---------- Networks initialized -------------

[Network G_A] Total number of parameters : 11.378 M

[Network G_B] Total number of parameters : 11.378 M

[Network D_A] Total number of parameters : 2.765 M

[Network D_B] Total number of parameters : 2.765 M

-----------------------------------------------

Actual Error

model [CycleGANModel] was created create web directory ./checkpoints\experiment_name\web... THCudaCheck FAIL file=c:\programdata\miniconda3\conda-bld\pytorch_1524549877902\work\aten\src\thc\generic/THCStorage.cu line=58 error=2 : out of memory Traceback (most recent call last): File "train.py", line 31, in model.optimize_parameters() File "C:\Users\Luke Chen\Desktop\Painter\models\cycle_gan_model.py", line 157, in optimize_parameters self.backward_G() File "C:\Users\Luke Chen\Desktop\Painter\models\cycle_gan_model.py", line 146, in backward_G self.rec_B = self.netG_A(self.fake_A) File "C:\Users\Luke Chen\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 491, in call result = self.forward(*input, kwargs) File "C:\Users\Luke Chen\Anaconda3\lib\site-packages\torch\nn\parallel\data_parallel.py", line 112, in forward return self.module(*inputs[0], *kwargs[0]) File "C:\Users\Luke Chen\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 491, in call result = self.forward(input, kwargs) File "C:\Users\Luke Chen\Desktop\Painter\models\networks.py", line 199, in forward return self.model(input) File "C:\Users\Luke Chen\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 491, in call result = self.forward(*input, *kwargs) File "C:\Users\Luke Chen\Anaconda3\lib\site-packages\torch\nn\modules\container.py", line 91, in forward input = module(input) File "C:\Users\Luke Chen\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 491, in call result = self.forward(input, **kwargs) File "C:\Users\Luke Chen\Desktop\Painter\models\networks.py", line 241, in forward out = x + self.conv_block(x) RuntimeError: cuda runtime error (2) : out of memory at c:\programdata\miniconda3\conda-bld\pytorch_1524549877902\work\aten\src\thc\generic/THCStorage.cu:58