OpenNMT / OpenNMT

Open Source Neural Machine Translation in Torch (deprecated)

Home Page:https://opennmt.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Updating ensemble branch to be compatible with current OpenNMT version

RikVN opened this issue · comments

This issue is related to this thread on the forum. I got an error using the ensemble-branch when using a model that is trained with the current OpenNMT Lua version. It would be great if this was updated so we can use this functionality again!

Some specifics, I trained the model like this (parameters default if not specified, from OpenNMT folder):

th train.lua -train_src src.txt -train_tgt tgt.txt -valid_src valid_src.txt -valid_tgt valid_target.txt -src_vocab vcb.src.dict -tgt_vocab vcb.tgt.dict -src_seq_length 1000 -tgt_seq_length 1000 -src_word_vec_size 500
-tgt_word_vec_size 500 -layers 2 -rnn_size 250 -rnn_type LSTM -save_model model -dropout 0.3 -encoder_type brnn -gpuid 1

And then translated like this (from OpenNMT-ensemble folder):

th translate.lua -src src.txt -output output.txt -model ../OpenNMT/model_epoch15_1.11.t7 ../OpenNMT/model_epoch14_1.12.t7 -max_sent_length 1000 -replace_unk -gpuid 1

which resulted in this error (even when doing a single model):

./onmt/utils/Tensor.lua:137: in function 'initTensorTable'
./onmt/modules/Encoder.lua:201: in function 'forward'
./onmt/modules/BiEncoder.lua:151: in function 'forward'
./onmt/translate/Translator.lua:331: in function 'fun'
./onmt/utils/ThreadPool.lua:24: in function 'dispatch'
./onmt/translate/Translator.lua:326: in function 'translateBatch'
./onmt/translate/Translator.lua:532: in function 'translate'
translate.lua:110: in function 'main'
translate.lua:201: in main chunk
[C]: in function 'dofile'
...6548/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: in ?

The OpenNMT thread already had an suggestion, but unfortunately this did not work. Thanks in advance for looking into this!

The branch has been updated thanks to @vitaka.