Torch: not enough memory on gcloud n1-standard-8 (8 vCPUs, 30 GB memory) VM
eltabre opened this issue · comments
When I am running this command:
th neural_style.lua -style_image style01.jpg -content_image content01.jpg -gpu -1 -print_iter 1 -image_size 1440 -output_image riva.png
I keep getting this error after it goes through one cycle. I am running on the gcloud n1-standard-8 (8 vCPUs, 30 GB memory) VM with no GPU. Is there a fix for this?
Capturing style target 1
Running optimization with L-BFGS
Iteration 1 / 1000
Content 1 loss: 1912746.718750
Style 1 loss: 62537.304688
Style 2 loss: 2843508.789062
Style 3 loss: 1271865.527344
Style 4 loss: 52406890.625000
Style 5 loss: 2104.088974
Total loss: 58499653.053818
<optim.lbfgs> creating recyclable direction/step/history buffers
/home/taberf/torch/install/bin/luajit: /home/taberf/torch/install/share/lua/5.1/optim/lbfgs.lua:84: $ Torch: not enough memory: you tried to allocate 1GB. Buy new RAM! at /home/taberf/torch/pkg/torch/lib/TH/THGeneral.c:270
stack traceback:
[C]: in function 'new'
/home/taberf/torch/install/share/lua/5.1/optim/lbfgs.lua:84: in function 'lbfgs'
neural_style.lua:303: in function 'main'
neural_style.lua:601: in main chunk
[C]: in function 'dofile'
...berf/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00406670
Most likely you are indeed getting out of memory with your image size (I have 24G so I know).
Try finding the size that works. Memory requirements increase very fast with image size. Note also that it is the image area that matters, square images require more memory.
You could try this tiled modification of Neural-Style if you want to create bigger images: https://github.com/VaKonS/neural-style