jcjohnson / neural-style

Torch implementation of neural style algorithm
MIT License
18.31k stars 2.7k forks source link

cuda runtime error (2) : out of memory #305

Open suenos5 opened 8 years ago

suenos5 commented 8 years ago

Hi,

I'm trying to get a size as 1920 mov video but i've gotta issue with this.

By the way, my desktop's condition is as following by this. 6700K and 4GB GTX 970.

Computing optical flow. This may take a while... [libprotobuf WARNING google/protobuf/io/coded_stream.cc:505] Reading dangerously large protocol message. If the message turns out to be larger than 1073741824 bytes, parsing will be halted for security reasons. To increase the limit (or to disable these warnings), see CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h. [libprotobuf WARNING google/protobuf/io/coded_stream.cc:78] The total number of bytes read was 574671192 Successfully loaded models/VGG_ILSVRC_19_layers.caffemodel conv1_1: 64 3 3 3 conv1_2: 64 64 3 3 conv2_1: 128 64 3 3 conv2_2: 128 128 3 3 conv3_1: 256 128 3 3 conv3_2: 256 256 3 3 conv3_3: 256 256 3 3 conv3_4: 256 256 3 3 conv4_1: 512 256 3 3 conv4_2: 512 512 3 3 conv4_3: 512 512 3 3 conv4_4: 512 512 3 3 conv5_1: 512 512 3 3 conv5_2: 512 512 3 3 conv5_3: 512 512 3 3 conv5_4: 512 512 3 3 fc6: 1 1 25088 4096 fc7: 1 1 4096 4096 fc8: 1 1 4096 1000 Style image size: 1250 x 703
Setting up temporal consistency.
Setting up style layer 2 : relu1_1
Setting up style layer 7 : relu2_1
Setting up style layer 12 : relu3_1
Setting up style layer 21 : relu4_1
Setting up content layer 23 : relu4_2
Setting up style layer 30 : relu5_1
Detected 76 content images.
Running optimization with L-BFGS
THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-1062/cutorch/lib/THC/generic/THCStorage.cu line=40 error=2 : out of memory /home/jlinu/torch/install/bin/luajit: /home/jlinu/torch/install/share/lua/5.1/nn/Container.lua:67: In 4 module of nn.Sequential: In 2 module of nn.Sequential: /home/jlinu/torch/install/share/lua/5.1/nn/ConcatTable.lua:68: cuda runtime error (2) : out of memory at /tmp/luarocks_cutorch-scm-1-1062/cutorch/lib/THC/generic/THCStorage.cu:40 stack traceback: [C]: in function 'resizeAs' /home/jlinu/torch/install/share/lua/5.1/nn/ConcatTable.lua:68: in function </home/jlinu/torch/install/share/lua/5.1/nn/ConcatTable.lua:30> [C]: in function 'xpcall' /home/jlinu/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors' /home/jlinu/torch/install/share/lua/5.1/nn/Sequential.lua:84: in function 'backward' ./artistic_video_core.lua:387: in function 'updateGradInput' /home/jlinu/torch/install/share/lua/5.1/nn/Module.lua:31: in function </home/jlinu/torch/install/share/lua/5.1/nn/Module.lua:29> [C]: in function 'xpcall' /home/jlinu/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors' /home/jlinu/torch/install/share/lua/5.1/nn/Sequential.lua:84: in function 'backward' ./artistic_video_core.lua:93: in function 'opfunc' ./lbfgs.lua:68: in function 'optimize' ./artistic_video_core.lua:120: in function 'runOptimization' artistic_video.lua:259: in function 'main' artistic_video.lua:355: in main chunk [C]: in function 'dofile' ...linu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: at 0x00406670

WARNING: If you see a stack trace below, it doesn't point to the place where this error occured. Please use only the one above. stack traceback: [C]: in function 'error' /home/jlinu/torch/install/share/lua/5.1/nn/Container.lua:67: in function 'rethrowErrors' /home/jlinu/torch/install/share/lua/5.1/nn/Sequential.lua:84: in function 'backward' ./artistic_video_core.lua:93: in function 'opfunc' ./lbfgs.lua:68: in function 'optimize' ./artistic_video_core.lua:120: in function 'runOptimization' artistic_video.lua:259: in function 'main' artistic_video.lua:355: in main chunk [C]: in function 'dofile' ...linu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk

[C]: at 0x00406670

I want to sort it out this problem, which is that

B- Running optimization with L-BFGS
THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-1062/cutorch/lib/THC/generic/THCStorage.cu line=40 error=2 : out of memory",

which seems like the main issue with it.

Or even that i just need to buy an 1070 or 980ti graphic card or not. Also, need a size, at least, 1024x540(or 1280_720) and the good quality as HD with 1920_1080.

Plus, i'm wondering about the resolution of outfoot size is possibly get some twice impact as 1024 or 2048.

Thank you!

htoyryla commented 8 years ago

Doesn't look like plain neural-style, but something similar tuned for handling video. This one maybe https://github.com/manuelruder/artistic-videos ?

suenos5 commented 8 years ago

Thanks, but I'm using the source link your reply.

htoyryla commented 8 years ago

I don't understand what you mean. You posted the issue at https://github.com/jcjohnson/neural-style and this project has no scripts named artistic_video.lua or artistic_video_core.lua referred to in your error output. This neural-style never prints "Computing optical flow" or "Detected 76 content images." This neural-style processes a single content image, not video. So your problem is with some other project, regardless of the fact that people can experience out of cuda memory with this project, too.

It has happened before that someone posted an issue relate to artistic-videos here.

suenos5 commented 8 years ago

I just want to make a size from 960x960 and now i want to reach at 1280,1920 size.

It seems you're describing about the image but i need a video rather than image. Plus, i've done with smaller size of video.

My main issue is this." cuda runtime error (2) : out of memory"

suenos5 commented 8 years ago

http://liipetti.net/erratic/2016/02/14/switching-to-a-smaller-net/ this is your post? i want to solution 1280px without running over 4 GB,........

3DTOPO commented 8 years ago

You simply don't have enough VRAM in your video card.

Furthermore, you are asking for help for a different project than what you want help with.

htoyryla commented 8 years ago

@suenos5 yes, you appear to have read my blog post, but now you are posting on the issues page of @jcjohnson's neural-style project . Also, @3DTOPO is right, you need a card with more memory, and even then we cannot say if you will be able to do the size that you want. I haven't even tried the video project you are using.

Anyhow, have a look at https://github.com/manuelruder/artistic-videos#requirements . It says that with CuDNN, you need 1.7GB for 450x350 and the memory increases linearly with dimensions. So you should be able to get to somewhat over 900x700 with 8GB (two dimensions double = four times memory). Not much more. They also point that using ADAM and NIN could help, but they haven't tried. Neither have I with https://github.com/manuelruder/artistic-video .