jcjohnson / densecap

Dense image captioning in Torch
MIT License
1.58k stars 432 forks source link

run_model.lua fails with "cudnn.convert does not work with nngraph yet" #34

Closed snowmonkeypc closed 8 years ago

snowmonkeypc commented 8 years ago

run_model.lua fails for me when I run in GPU mode:

$ th run_model.lua -input_image imgs/elephant.jpg

/Users/snowm/torch/install/bin/luajit: /Users/snowm/torch/install/share/lua/5.1/cudnn/convert.lua:26: cudnn.convert does not work with nngraph yet
stack traceback:
        [C]: in function 'error'
        /Users/snowm/torch/install/share/lua/5.1/cudnn/convert.lua:26: in function 'callback'
        ...rs/snowm/torch/install/share/lua/5.1/nngraph/gmodule.lua:197: in function 'replace'
        /Users/snowm/torch/install/share/lua/5.1/nn/Module.lua:391: in function 'convert'
        ./densecap/DenseCapModel.lua:205: in function 'convert'
        run_model.lua:148: in main chunk
        [C]: in function 'dofile'
        ...nowm/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
        [C]: at 0x010a1c0d10

CPU mode works perfectly:

$ th run_model.lua -input_image imgs/elephant.jpg -gpu -1
1/1 processing image imgs/elephant.jpg
jcjohnson commented 8 years ago

Try upgrading cudnn and nngraph:

luarocks install cudnn
luarocks install nngraph
soumith commented 8 years ago

@snowmonkeypc updating cudnn will fix it via:

luarocks install cudnn

snowmonkeypc commented 8 years ago

Thanks! "luarocks install cudnn" turned the error into a warning. Is that expected?

I'm now stuck with an "out of memory" error. Only 2 GB VRAM in this machine (and probably much less available even directly after reboot), guess it's simply not enough.

$ th run_model.lua -input_image imgs/elephant.jpg
Warning: cudnn.convert does not work with nngraph yet. Ignoring nn.gModule1/1 processing image imgs/elephant.jpg
THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-4722/cutorch/lib/THC/generic/THCStorage.cu line=40 error=2 : out of memory
/Users/snowm/torch/install/bin/luajit: /Users/snowm/torch/install/share/lua/5.1/nn/Container.lua:67:
In 4 module of nn.Sequential:
In 5 module of nn.Sequential:
/Users/snowm/torch/install/share/lua/5.1/nn/Linear.lua:61: cuda runtime error (2) : out of memory at /tmp/luarocks_cutorch-scm-1-4722/cutorch/lib/THC/generic/THCStorage.cu:40
stack traceback:
        [C]: in function 'resize'
        /Users/snowm/torch/install/share/lua/5.1/nn/Linear.lua:61: in function </Users/snowm/torch/install/share/lua/5.1/nn/Linear.lua:53>
        [C]: in function 'xpcall'
        /Users/snowm/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
        /Users/snowm/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'func'
        ...rs/snowm/torch/install/share/lua/5.1/nngraph/gmodule.lua:345: in function 'neteval'
        ...rs/snowm/torch/install/share/lua/5.1/nngraph/gmodule.lua:380: in function <...rs/snowm/torch/install/share/lua/5.1/nngraph/gmodule.lua:300>
        [C]: in function 'xpcall'
        /Users/snowm/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
        /Users/snowm/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
        ./densecap/DenseCapModel.lua:253: in function 'forward'
        ./densecap/DenseCapModel.lua:321: in function 'forward_test'
        run_model.lua:77: in function 'run_image'
        run_model.lua:164: in main chunk
        [C]: in function 'dofile'
        ...nowm/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
        [C]: at 0x0101c8dd10

Closing this issue since original problem is solved. Thanks again.

snowmonkeypc commented 8 years ago

Ah found #11. So I need about 6GB of VRAM. Time to upgrade ;)