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

Error while computing probabilities of gold data using a model without attention #28

Closed angelikilazaridou closed 8 years ago

angelikilazaridou commented 8 years ago

Hi there,

I seem to be having a problem when trying to compute the probabilities of the gold data under some model trained without attention. While I'm able to decode and obtain predictions, when scoring the gold data (i.e., by using the option parameter -targ_file data/targ-val.txt on the demo data), the model produces the following error.

As a note, everything works smoothly if I train with attention.

command

th beam.lua -model demo-model_epoch1.00_3095.37.t7  -src_file data/src-val.txt -targ_file data/targ-val.txt  -output_file pred.txt -src_dict data/demo.src.dict -targ_dict data/demo.targ.dict  -gpuid 1

output

loading demo-model_epoch1.00_3095.37.t7...  
done!   
loading GOLD labels at data/targ-val.txt    
SENT 1: Parliament Does Not Support Amendment Freeing Tymoshenko    
/auto/rcf-40/al_227/torch/install/bin/luajit: ...f-40/al_227/torch/install/share/lua/5.1/nn/JoinTable.lua:39: bad argument #1 to 'copy' (sizes do not match at /tmp/luarocks_cutorch-scm-1-3925/cutorch/lib/THC/generic/THCTensorCopy.cu:10)
stack traceback:
    [C]: in function 'copy'
    ...f-40/al_227/torch/install/share/lua/5.1/nn/JoinTable.lua:39: in function 'func'
    ...0/al_227/torch/install/share/lua/5.1/nngraph/gmodule.lua:311: in function 'neteval'
    ...0/al_227/torch/install/share/lua/5.1/nngraph/gmodule.lua:346: in function 'forward'
    beam.lua:325: in function 'generate_beam'
    beam.lua:637: in function 'main'
    beam.lua:672: in main chunk
    [C]: in function 'dofile'
    ..._227/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
    [C]: at 0x00405800

Cheers, Angeliki

yoonkim commented 8 years ago

thanks for catching this--i pushed a fix for it. let me know if it works!

angelikilazaridou commented 8 years ago

Great, it worked! Thanks a lot!