luanfujun / deep-painterly-harmonization

Code and data for paper "Deep Painterly Harmonization": https://arxiv.org/abs/1804.03189
6.07k stars 626 forks source link

handling out of memory #4

Open duhaime opened 6 years ago

duhaime commented 6 years ago

Thanks very much for this inspiring work. I'm trying to run this on an NVIDIA Quadro P4000 and am getting:

...
Setting up style layer      12  :   relu3_1
THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-7191/cutorch/lib/THC/generic/THCStorage.cu line=66 error=2 : out of memory
/home/localadmin/torch/install/bin/luajit: .../localadmin/torch/install/share/lua/5.1/nn/Container.lua:67:
In 11 module of nn.Sequential:
cuda runtime error (2) : out of memory at /tmp/luarocks_cutorch-scm-1-7191/cutorch/lib/THC/generic/THCStorage.cu:66
stack traceback:
    [C]: at 0x7f1471b9dcc0
    [C]: in function 'cmul'
    neural_paint.lua:576: in function <neural_paint.lua:575>
    [C]: in function 'xpcall'
    .../localadmin/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
    ...localadmin/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
    neural_paint.lua:237: in function 'main'
    neural_paint.lua:738: in main chunk
    [C]: in function 'dofile'
    ...dmin/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
    [C]: at 0x00405d50

Do you have any pointers on how one might go about resolving an OOM result like this?

luanfujun commented 6 years ago

Hey thanks! All the results were generated using a Titan gpu (12GB memory) with resolution 700^2. I looked up the P4000 and it has 8GB memory. Could you try decreasing the image size to 500^2 or something?

aaronsherwood commented 6 years ago

When changing the image size you also have to change it in gen_all.py in two places: -image_size 700

MaxChanger commented 6 years ago

vim gen_all.py find -image_size 700 , there are two places have this sentence, replace it with-image_size 500 or -image_size 300 I useI7-6700HQ 12G Geforce 950M 4G memory , when I use 500, the memory of GPU is 3920MiB / 4046MiB, but it's too slow, 300 is a better choice for me.

xiaer1 commented 6 years ago

Thanks for this project

HandsomeDevilv112 commented 5 years ago

would it be at all possible to use multiple gpus? I tried adjusting "-gpu 0,1" like I can do with neural-style, but I received an error about it