Open yapingzhao opened 6 years ago
@yapingzhao hack in source , when beam_width=0, nmt will output the final_state , then you can find the alignments.
@hpulfc Dear, where I can find the final_state and alignments? thanks
@JulianZhang
see the code in nmt/attention_model.py
. it in the method named _create_attention_images_summary
like this:
def _create_attention_images_summary(final_context_state):
pass
@hpulfc can you please elaborate how to visualize the attention matrix for particular source and target sentence ?
you can backtrace function : plot_attention in this notebook - https://github.com/tensorflow/tensorflow/blob/r1.11/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb. Do let me know if it doesn't work for you.
@ranjita-naik i tried but it won't work. As I have trained my model and i have corresponding translated file too using tensorflow nmt . I want to view attention of those any of input and output sentences. Would you please suggest how to visualize the attention on tensorflow nmt. Thank you in advance.
@kritinemkul, what's the error? as shown in the evaluate(sentence, encoder, decoder, inp_lang, targ_lang, max_length_inp, max_length_targ) function, are you collecting attention weights during inference?
@ranjita-naik, this only works for the pairs which are printed in third cell and there is nothing any like development set and test set. If i gave the sentence other than the printed it will give error of unknown keyword. What i want is, trained the model and infer the out put sentences too as shown in the nmt tutorial. I am unable to show attention for those sentences. Is there any way to visualize attention for those sentence in tensorboard on in command prompt or in any way?
Hi, What is the command to get the alignments between source and target sentences ? Looking forward to your advice or answers. Best regards, Thank you very much!