tensor2tensor icon indicating copy to clipboard operation
tensor2tensor copied to clipboard

Attention visualization

Open stefan-it opened this issue 9 years ago • 7 comments

Hi,

in the appendix of Attention Is All You Need some very nice visualizations of the attention mechanism can be seen.

How can I create those visualizations for my own dataset/language pair?

Would be great if the authors can give some hints :)

stefan-it avatar Jul 12 '17 20:07 stefan-it

LLion, who wrote the scripts to do the visualizations, is on vacation this week. I'll leave this open and ping when he's back.

lukaszkaiser avatar Jul 13 '17 00:07 lukaszkaiser

@lukaszkaiser That would be great :)

stefan-it avatar Jul 17 '17 09:07 stefan-it

@lukaszkaiser I too will wait for this. Thanks very much for the guidance

vishalnus avatar Jul 20 '17 06:07 vishalnus

It seems that dot_product_attention (which is used in multihead_attention which is used in the Transformer) calls attention_image_summary which adds an image summary op, which should be written out to TensorBoard during training. Have you checked the image summaries tab in TensorBoard during training?

rsepassi avatar Aug 03 '17 18:08 rsepassi

https://github.com/tensorflow/tensor2tensor/blob/master/tensor2tensor/layers/common_attention.py#L285

rsepassi avatar Aug 03 '17 18:08 rsepassi

I meant these kind of visualizations:

visu

:)

stefan-it avatar Aug 10 '17 12:08 stefan-it

An iPython notebook with our viz code is included in the new release 1.2.0, give it a try!

lukaszkaiser avatar Aug 26 '17 00:08 lukaszkaiser