diff --git a/fluid/neural_machine_translation/transformer/infer.py b/fluid/neural_machine_translation/transformer/infer.py index 2338975f980e472224e599d83891f2b27f814ece..5634f160a99f83dd1b35e83251c303604f7e78a1 100644 --- a/fluid/neural_machine_translation/transformer/infer.py +++ b/fluid/neural_machine_translation/transformer/infer.py @@ -301,6 +301,9 @@ def main(): trg_idx2word = paddle.dataset.wmt16.get_dict( "de", dict_size=ModelHyperParams.trg_vocab_size, reverse=True) + # Append the token since the dict provided by dataset.wmt16 does + # not include it. + trg_idx2word[ModelHyperParams.trg_pad_idx] = "" def post_process_seq(seq, bos_idx=ModelHyperParams.bos_idx,