harvardnlp/seq2seq-attn

Issue with evaluate script.

randomizedai opened this issue · 3 comments

Hi,

I get the following error while running evaluation script:

seq2seq-attn-master$ th evaluate.lua -model demo-model_final.t7 -src_file data/src-val.txt -output_file pred.txt -src_dict data/demo.src.dict -targ_dict data/demo.targ.dict
loading demo-model_final.t7...
done!
/Users/gupta/torch/install/bin/lua: ./s2sa/beam.lua:417: table index is nil
stack traceback:
./s2sa/beam.lua:417: in function 'idx2key'
./s2sa/beam.lua:650: in function 'init'
evaluate.lua:4: in function 'main'
evaluate.lua:30: in main chunk
[C]: in function 'dofile'
...upta/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: in ?

Any suggestions ?

regards,
Amit

Did you manually edit the generated dictionaries data/demo.src.dict and data/demo.targ.dict?

You can restart the preprocessing on the same dataset to make sure your dictionaries are valid.

No, I used the exact same commands as mentioned in the readme file. I am using Mac OS X sierra. I also tried running preprocess again, as well as running the entire training again.

I am using only 3 epochs for now to quickly see initial results. Could that make a difference ?

I found the issue. It's on line no 415 in beam.lua:

for w in line:gmatch'([^%s]+)' do

the above gmatch command fails when the first character of token is not ascii.

That was causing the issue. For now, I fixed it by just ignoring such tokens.