harvardnlp / seq2seq-attn

Sequence-to-sequence model with LSTM encoder/decoders and attention
http://nlp.seas.harvard.edu/code
MIT License
1.26k stars 278 forks source link

Trouble with Spatial Convolution #76

Closed alashkari closed 7 years ago

alashkari commented 7 years ago

Hello everyone,

I am trying to run a pre-trained model on my machine. The problem is that when I intend to load the model, I get this error:

~/torch/install/bin/luajit: ~/.luarocks/share/lua/5.1/torch/File.lua:343: unknown Torch class stack traceback: [C]: in function 'error' /home/rui/.luarocks/share/lua/5.1/torch/File.lua:343: in function 'readObject' /home/rui/.luarocks/share/lua/5.1/torch/File.lua:369: in function 'readObject' /home/rui/.luarocks/share/lua/5.1/torch/File.lua:369: in function 'readObject' /home/rui/.luarocks/share/lua/5.1/torch/File.lua:369: in function 'readObject' /home/rui/.luarocks/share/lua/5.1/torch/File.lua:369: in function 'readObject' /home/rui/.luarocks/share/lua/5.1/torch/File.lua:353: in function 'readObject' /home/rui/.luarocks/share/lua/5.1/torch/File.lua:369: in function 'readObject' /home/rui/.luarocks/share/lua/5.1/torch/File.lua:369: in function 'readObject' /home/rui/.luarocks/share/lua/5.1/torch/File.lua:353: in function 'readObject' /home/rui/.luarocks/share/lua/5.1/torch/File.lua:369: in function 'readObject' ... /home/rui/.luarocks/share/lua/5.1/torch/File.lua:351: in function 'readObject' /home/rui/.luarocks/share/lua/5.1/torch/File.lua:369: in function 'readObject' /home/rui/.luarocks/share/lua/5.1/torch/File.lua:369: in function 'readObject' /home/rui/.luarocks/share/lua/5.1/torch/File.lua:409: in function 'load' ./beam.lua:505: in function 'init' evaluate.lua:5: in function 'main'

I should tell you that I have installed Cuda (V8) and cuDNN, and I don't have any problem when I start to train the model myself. This error occurs when I try to use a pre-trained model.

Thank you for your time and help in advance.

guillaumekln commented 7 years ago

Are you also using -cudnn 1 on the command line?

alashkari commented 7 years ago

I am using the pre-trained model with evaluate.lua script, which doesn't have -cudnn as the input. During the training of the pre-trained model, Yes.

guillaumekln commented 7 years ago

You should also use -cudnn 1 for translation.

See https://github.com/harvardnlp/seq2seq-attn/blob/master/s2sa/beam.lua#L44.

alashkari commented 7 years ago

Thank you Guillaumekln. You saved me. I added (-cudnn -gpuid and char_dict) and it is perfectly working now.