Element-Research / rnn

Recurrent Neural Network library for Torch7's nn
BSD 3-Clause "New" or "Revised" License
941 stars 313 forks source link

Add model loading for RAM (work in progress) #293

Closed yenchenlin closed 8 years ago

yenchenlin commented 8 years ago

Hello @nicholas-leonard , I have to admit that I'm new to Torch. I try to add this functionality according to your reply in #290 , but it outputs the following error:

...clin/torch/install/share/lua/5.1/dpnn/SpatialGlimpse.lua:118: attempt to index local 'gradInput' (a nil value)
stack traceback:
        ...clin/torch/install/share/lua/5.1/dpnn/SpatialGlimpse.lua:118: in function <...clin/torch/install/share/lua/5.1/dpnn/SpatialGlimpse.lua:112>
        [C]: in function 'xpcall'
        /home/yclin/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
        /home/yclin/torch/install/share/lua/5.1/nn/Sequential.lua:58: in function </home/yclin/torch/install/share/lua/5.1/nn/Sequential.lua:50>
        [C]: in function 'xpcall'
        /home/yclin/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
        /home/yclin/torch/install/share/lua/5.1/nn/ConcatTable.lua:35: in function </home/yclin/torch/install/share/lua/5.1/nn/ConcatTable.lua:30>
        [C]: in function 'xpcall'
        /home/yclin/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
        /home/yclin/torch/install/share/lua/5.1/nn/Sequential.lua:58: in function </home/yclin/torch/install/share/lua/5.1/nn/Sequential.lua:50>
        ...
        /home/yclin/torch/install/share/lua/5.1/dpnn/Decorator.lua:16: in function 'updateGradInput'
        /home/yclin/torch/install/share/lua/5.1/nn/Module.lua:31: in function 'backward'
        .../torch/install/share/lua/5.1/dp/propagator/optimizer.lua:72: in function 'backward'
        .../torch/install/share/lua/5.1/dp/propagator/optimizer.lua:52: in function 'propagateBatch'
        ...torch/install/share/lua/5.1/dp/propagator/propagator.lua:127: in function 'propagateEpoch'
        ...torch/install/share/lua/5.1/dp/propagator/experiment.lua:110: in function 'run'
        train.lua:257: in main chunk
        [C]: in function 'dofile'
        ...clin/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
        [C]: at 0x00406670

Did I miss anything?

nicholas-leonard commented 8 years ago

@yenchenlin Your PR works on my end. This is the command I used: th examples/recurrent-visual-attention.lua --xpPath /home/nicholas14/save/rhea:1464273898:1.dat --dataset TranslatedMnist --cuda

What command did you use?

yenchenlin commented 8 years ago

Hello @nicholas-leonard , the command I used is th examples/recurrent-visual-attention.lua --xpPath path/to/my/model , and I also modify the script become cmd:option('--cuda', true, 'use CUDA').

I'm using Ubuntu 14.04 Cuda 7.5 and cudnn v4.

Here is what I got:

==> epoch # 1 for optimizer :
^C/home/yclin/torch/install/bin/luajit: /home/yclin/torch/install/share/lua/5.1/nn/Container.lua:67: Step: 0ms
In 2 module of nn.Sequential:
In 1 module of nn.Sequential:
In 1 module of nn.ParallelTable:
In 1 module of nn.Sequential:
In 2 module of nn.ConcatTable:
In 1 module of nn.Sequential:
...clin/torch/install/share/lua/5.1/dpnn/SpatialGlimpse.lua:80: interrupted!
stack traceback:
    ...clin/torch/install/share/lua/5.1/dpnn/SpatialGlimpse.lua:80: in function <...clin/torch/install/share/lua/5.1/dpnn/SpatialGlimpse.lua:45>
    [C]: in function 'xpcall'
    /home/yclin/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
    /home/yclin/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function </home/yclin/torch/install/share/lua/5.1/nn/Sequential.lua:41>
    [C]: in function 'xpcall'
    /home/yclin/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
    /home/yclin/torch/install/share/lua/5.1/nn/ConcatTable.lua:11: in function </home/yclin/torch/install/share/lua/5.1/nn/ConcatTable.lua:9>
    [C]: in function 'xpcall'
    /home/yclin/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
    /home/yclin/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function </home/yclin/torch/install/share/lua/5.1/nn/Sequential.lua:41>
    ...
    /home/yclin/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'updateOutput'
    /home/yclin/torch/install/share/lua/5.1/dpnn/Decorator.lua:11: in function 'forward'
    ...torch/install/share/lua/5.1/dp/propagator/propagator.lua:162: in function 'forward'
lua/5.1/nn/Sequential.lua:50>
        ...
        /home/yclin/torch/install/share/lua/5.1/dpnn/Decorator.lua:16: in function 'updateGradInput'
        /home/yclin/torch/install/share/lua/5.1/nn/Module.lua:31: in function 'backward'
        .../torch/install/share/lua/5.1/dp/propagator/optimizer.lua:72: in function 'backward'
        .../torch/install/share/lua/5.1/dp/propagator/optimizer.lua:52: in function 'propagateBatch'
        ...torch/install/share/lua/5.1/dp/propagator/propagator.lua:127: in function 'propagateEpoch'
        ...torch/install/share/lua/5.1/dp/propagator/experiment.lua:110: in function 'run'
        train.lua:254: in main chunk
        [C]: in function 'dofile'
        ...clin/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
        [C]: at 0x00406670
nicholas-leonard commented 8 years ago

@yenchenlin I just fixed the SpatialGlimpse bug here : https://github.com/Element-Research/dpnn/commit/da974ff0ad6b34f5283235cba777930e7de36b88 . With your merged changes, that seems to fix it. Let met know if it works for you and thanks for the PR !

yenchenlin commented 8 years ago

@nicholas-leonard Thanks a lot! Now it works. 😄