thushv89/attention_keras

Translation is wrong + error ?

Closed this issue · 2 comments

Hi,

Nice module, however I have some concern with the examples.
I am using keras 2.2.4 and TF 1.13.1 GPU.
The nmt_bidirectional example is failing:

examples.nmt_bidirectional.train | INFO | Loss in epoch 5: 0.00024022466588457427
examples.nmt_bidirectional.train | INFO | Translating: the united states is sometimes chilly during december , but it is sometimes freezing in june .

examples.nmt_bidirectional.train | INFO |       French:
Traceback (most recent call last):
  File "train.py", line 164, in <module>
    plot_attention_weights(test_en_seq, attn_weights, en_index2word, fr_index2word)
  File "/gpfs/workdir/popineau/attention_keras/examples/utils/model_helper.py", line 17, in plot_attention_weights
    assert len(attention_weights) != 0, assert_msg
AssertionError: Your attention weights was empty. Please check if the decoder produced  a proper translation

Regards,

Obviously the error was because the decoder did not produce a valid output. But this shouldn't be happening. I will rerun the model and try to see if I can find what the error is.

There was an error in the nmt bidirectional. It was using bidirectional for both the encoder and the decoder while it should only be using bidirectinoal for the encoder. I have fixed this see if that improves the results. Thanks for spotting this. If there are more issues feel free to reopen this.