yoonkim / lstm-char-cnn

LSTM language model with CNN over characters
MIT License
826 stars 221 forks source link

New version without Squeeze.lua causes error #18

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi:

The previous version using Squeeze.lua works fine.
I would like to test sample.lua but it does not work with the previous version.

I'm new to lua/torch and I would like to sample from this model as per karpathy's original.

When I run the new version without Squeeze.lua I get the following error which is referencing 'Squeeze':

ne-time setup: preprocessing input train/valid/test files in dir: data/ptb
Processing text into tensors... After first pass of data, max word length is: 26
Token count: train 10124, val 1408, test 3570
done
saving data/ptb/vocab.t7
saving data/ptb/data.t7 saving data/ptb/data_char.t7
loading data files...
Word vocab size: 4040, Char vocab size: 71
reshaping tensors...
data load done. Number of batches in train: 14, val: 2, test: 1 Word vocab size: 4040, Char vocab size: 71, Max word length (incl. padding): 26
creating an LSTM-CNN with 2 layers
/home/pixelhead/torch/install/bin/luajit: ./model/TDNN.lua:35: attempt to call field 'Squeeze' (a nil value) stack traceback: ./model/TDNN.lua:35: in function 'tdnn' ./model/LSTMTDNN.lua:53: in function 'lstmtdnn' main.lua:150: in main chunk [C]: in function 'dofile' ...head/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: at 0x00406670

Is there another switch I should set to fix this?

Thanks,

yoonkim commented 8 years ago

Try updating your nn package.

ghost commented 8 years ago

Thanks for getting back to me. I ran luarocks list: nn scm-1 (installed) - /home/pixelhead/torch/install/lib/luarocks/rocks ran again: luarocks install nn same nn-scm-1.rockspec but when running main.lua a different error referencing 'TestSuite':

home/pixelhead/torch/install/bin/luajit: /home/pixelhead/torch/install/share/lua/5.1/trepl/init.lua:383: /home/pixelhead/torch/install/share/lua/5.1/trepl/init.lua:383: /home/pixelhead/torch/install/share/lua/5.1/nn/test.lua:12: attempt to call field 'TestSuite' (a nil value) stack traceback: [C]: in function 'error' /home/pixelhead/torch/install/share/lua/5.1/trepl/init.lua:383: in function 'require' main.lua:11: in main chunk [C]: in function 'dofile' ...head/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: at 0x00406670

Should I update all modules listed under "luarocks list" ??? I'm new to torch/lua. I have karpathy's version including sample-beam.lua running without a problem and would like to compare sampled output from your program.

yoonkim commented 8 years ago

Can you try updating torch/cunn too?

luarocks install torch luarocks install cunn

It worked for me when I installed the latest versions.

ghost commented 8 years ago

Thanks. That worked.

Cheers