Error with replace_unk in train.lua

When trying to activate the replace_unk option in train.lua, I get this error:

[10/06/17 14:40:36 INFO] Saving validation translation to '/home/DATA/MANAGEMENT4/onmt-fr-en-modelDYN_epoch41_validation_translation.txt'...
/home/lm-dev8/torch/install/bin/luajit: ./onmt/translate/Translator.lua:275: attempt to call method 'max' (a nil value)
stack traceback:
        ./onmt/translate/Translator.lua:275: in function 'buildTargetWords'
        ./onmt/evaluators/TranslationEvaluator.lua:42: in function 'eval'
        ./onmt/train/Trainer.lua:172: in function 'eval'
        ./onmt/train/Trainer.lua:432: in function 'train'
        train.lua:194: in function 'main'
        train.lua:199: in main chunk
        [C]: in function 'dofile'
        ...dev8/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
        [C]: at 0x00405d50
1 Like

I will take a look but -replace_unk is not fully supported during evaluation. For historical reasons, the validation source sentences already contain <unk> symbols for out of vocabulary words.

It would be nice to change this discussion as a feature request : when using the BLEU validation metric, having <unk> in both input and output sentences, artificially enhances the resulting evaluation. To be accurate, all vocab translation tuning rules should be also available in the training evaluation.
:wink:

I have the same problem … I’m using “save_validation_translation_every 1” and the same problem appears with “replace_unk”.
Is there some solution?
Regards!