OpenNMT Forum

PRED No words predicted

opennmt-py

(Dimitar Shterionov) #1

Hello,

I trained two models with the most recent version of OpenNMT-py - EN-DE and EN-ES. But when I translate, the result is always an empty string. I get the following error message:

“PRED No words predicted”.

I saw this https://github.com/OpenNMT/OpenNMT-py/issues/1048 issue, but it’s not answered with a solution.

Anybody has any idea?

I trained on a TitanX GPU. Used adam, and others are default parameters for the training; for translation - default parameters as well.

Thanks in advance.
Kind regards,
Dimitar


(Vincent Nguyen) #2

You need to give more context please.

Give us the training command line the end of the log and the translate command line.

confirm your pytorch, python version as well as the omnt-py version (last one possibly)


(Dimitar Shterionov) #3

I am using anaconda virtual environment.

Versions:

Python: 3.6.8
opennmt-py: 0.7.0
pytorch: 1.0.0

Training command:

echo "4.1. Prepare the data..."
python $OPENNMT/preprocess.py \
    -train_src $DATADIR/train.tc.bpe.src \
    -train_tgt $DATADIR/train.tc.bpe.trg \
    -src_vocab $DATADIR/train.tc.bpe.src.json \
    -tgt_vocab $DATADIR/train.tc.bpe.trg.json \
    -valid_src $DATADIR/val.tc.bpe.src \
    -valid_tgt $DATADIR/val.tc.bpe.trg \
    -save_data $DATADIR/ready_to_train

echo "4.2. Train..."
python $OPENNMT/train.py \
    -data $DATADIR/ready_to_train \
    -gpu_ranks 0 \
    -optim adam \
    -log_file $MODELDIR/train.log \
    -valid_batch_size 12 \
    -save_model $MODELDIR/model

Translation command:

python $OPENNMT/translate.py \
    -model $MODELDIR/model_step_100000.pt \
    -src $INPUT \
    -output $INPUT.out \
    -gpu $DEVICEID

(Vincent Nguyen) #4

can you share the end of the train.log file ?


(Dimitar Shterionov) #5

I overwrote that in a consecutive test, so I cannot share the log, sorry.

Regardless, after the training finished, I got a validation perplexity and accuracy (the accuracy on EN-DE was 91.4) and the models were saved.

Cheers,
Dimitar


(Vincent Nguyen) #6

try to use the -fast flag as well as the -beam_size 5 flag in the translate.py command line


(Dimitar Shterionov) #7

OK, I will do so and report on results.