The example below uses the Moses tokenizer ( to prepare the data and the moses BLEU script for evaluation. This example if for training for the WMT’16 Multimodal Translation task (

Step 0. Download the data.

mkdir -p data/multi30k
wget &&  tar -xf training.tar.gz -C data/multi30k && rm training.tar.gz
wget && tar -xf validation.tar.gz -C data/multi30k && rm validation.tar.gz
wget && tar -xf mmt_task1_test2016.tar.gz -C data/multi30k && rm mmt_task1_test2016.tar.gz

Step 1. Preprocess the data.

for l in en de; do for f in data/multi30k/*.$l; do if [[ "$f" != *"test"* ]]; then sed -i "$ d" $f; fi;  done; done
for l in en de; do for f in data/multi30k/*.$l; do perl tools/tokenizer.perl -a -no-escape -l $l -q  < $f > $f.atok; done; done
onmt_preprocess -train_src data/multi30k/train.en.atok -train_tgt data/multi30k/ -valid_src data/multi30k/val.en.atok -valid_tgt data/multi30k/ -save_data data/multi30k.atok.low -lower

Step 2. Train the model.

onmt_train -data data/multi30k.atok.low -save_model multi30k_model -gpu_ranks 0

Step 3. Translate sentences.

onmt_translate -gpu 0 -model multi30k_model_* -src data/multi30k/test2016.en.atok -tgt data/multi30k/ -replace_unk -verbose -output multi30k.test.pred.atok

And evaluate

perl tools/multi-bleu.perl data/multi30k/ < multi30k.test.pred.atok