Element-Research / rnn

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

SeqLSTM.lua error (noise-contrastive-estimate.lua) #316

Closed namp closed 8 years ago

namp commented 8 years ago

Datasets load OK and model created, but then I get an error from SeqLSTM.lua.

I have completely followed the instructions for having Torch installed with Lua instead of LuaJIT and then installing rnn (and its dependencies)

th examples/noise-contrastive-estimate.lua --cuda --device 2 --startlr 1 --saturate 300 --cutoff 10 --progress --uniform 0.1 --seqlen 50 --batchsize 128 --trainsize 400000 --validsize 40000 --hiddensize '{250,250}' --k 400 --minlr 0.001 --momentum 0.9 { Z : 1 batchsize : 128 continue : "" cuda : true cutoff : 10 device : 2 dontsave : false dropout : 0 earlystop : 50 hiddensize : {250,250} id : "gbw:gpu1:1470477013:1" inputsize : 250 k : 400 maxepoch : 1000 maxnormout : -1 minlr : 0.001 momentum : 0.9 profile : false progress : true projsize : -1 rownoise : false saturate : 300 savepath : "/home/ampazis/save/rnnlm" seqlen : 50 silent : false startlr : 1 tiny : false trainsize : 400000 uniform : 0.1 validsize : 40000 version : 6 } loading /home/ampazis/data/BillionWords/train_data.th7 Formatting raw tensor into table of sequences saving cache /home/ampazis/data/BillionWords/train_data.cache.t7 loading /home/ampazis/data/BillionWords/valid_data.th7 Formatting raw tensor into table of sequences saving cache /home/ampazis/data/BillionWords/valid_data.cache.t7 loading /home/ampazis/data/BillionWords/test_data.th7 Formatting raw tensor into table of sequences saving cache /home/ampazis/data/BillionWords/test_data.cache.t7 Vocabulary size : 793471 Train set split into 128 sequences of length 6478523 Language Model: nn.Sequential { input -> (1) -> (2) -> (3) -> output: nn.ParallelTable { input |-> (1): nn.Sequential { | [input -> (1) -> (2) -> (3) -> (4) -> output] | (1): nn.LookupTableMaskZero | (2): nn.SeqLSTM | (3): nn.SeqLSTM | (4): nn.SplitTable | } |-> (2): nn.Identity ... -> output } (2): nn.ZipTable (3): nn.Sequencer @ nn.Recursor @ nn.MaskZero @ nn.NCEModule(250 -> 793471) }

Epoch #1 : /home/ampazis/torch/install/bin/lua: /home/ampazis/torch/install/share/lua/5.2/nn/Container.lua:67: In 1 module of nn.Sequential: In 1 module of nn.ParallelTable: In 2 module of nn.Sequential: /home/ampazis/torch/install/share/lua/5.2/rnn/SeqLSTM.lua:112: invalid arguments: CudaTensor CudaTensor number expected arguments: CudaTensor CudaByteTensor float stack traceback: [C]: in function 'maskedFill' /home/ampazis/torch/install/share/lua/5.2/rnn/SeqLSTM.lua:112: in function 'recursiveMask' /home/ampazis/torch/install/share/lua/5.2/rnn/SeqLSTM.lua:101: in function 'recursiveMask' /home/ampazis/torch/install/share/lua/5.2/rnn/SeqLSTM.lua:262: in function </home/ampazis/torch/install/share/lua/5.2/rnn/SeqLSTM.lua:169> [C]: in function 'xpcall' /home/ampazis/torch/install/share/lua/5.2/nn/Container.lua:63: in function 'rethrowErrors' /home/ampazis/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function </home/ampazis/torch/install/share/lua/5.2/nn/Sequential.lua:41> [C]: in function 'xpcall' /home/ampazis/torch/install/share/lua/5.2/nn/Container.lua:63: in function 'rethrowErrors' ...ampazis/torch/install/share/lua/5.2/nn/ParallelTable.lua:12: in function <...ampazis/torch/install/share/lua/5.2/nn/ParallelTable.lua:10> [C]: in function 'xpcall' /home/ampazis/torch/install/share/lua/5.2/nn/Container.lua:63: in function 'rethrowErrors' /home/ampazis/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function </home/ampazis/torch/install/share/lua/5.2/nn/Sequential.lua:41> (...tail calls...) examples/noise-contrastive-estimate.lua:219: in main chunk [C]: in function 'dofile' ...azis/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: in ?

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/ampazis/torch/install/share/lua/5.2/nn/Container.lua:67: in function 'rethrowErrors' /home/ampazis/torch/install/share/lua/5.2/nn/Sequential.lua:44: in function </home/ampazis/torch/install/share/lua/5.2/nn/Sequential.lua:41> (...tail calls...) examples/noise-contrastive-estimate.lua:219: in main chunk [C]: in function 'dofile' ...azis/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: in ?

JoostvDoorn commented 8 years ago

This is related to #313. I recommend installing cutorch version 1.0-0 for now instead of the latest version of cutorch.

namp commented 8 years ago

Excellent - will try it asap.

Thanks

namp commented 8 years ago

That did it!

Thanks again

ari-holtzman commented 8 years ago

I can't install cutorch 1.0-0 because I'm on Ubuntu 16.04...

Any word on when a permanent fix is coming?

namp commented 8 years ago

luarocks install https://github.com/torch/rocks/blob/master/cutorch-1.0-0.rockspec

ari-holtzman commented 8 years ago

Indeed! Unfortunately, as a user of Ubuntu 16.04, I cannot figure out anyway to get that to work, I only seem to be able to install the latest version of the master branch of cutorch...