opennmt

Getting alignment/attention during translation in OpenNMT-py

时光毁灭记忆、已成空白 提交于 2019-12-20 05:42:20
问题 Does anyone know how to get the alignments weights when translating in Opennmt-py? Usually the only output are the resulting sentences and I have tried to find a debugging flag or similar for the attention weights. So far, I have been unsuccessful. 回答1: You can get the attention matrices. Note that it is not the same as alignment which is a term from statistical (not neural) machine translation. There is a thread on github discussing it. Here is a snippet from the discussion. When you get the

Getting alignment/attention during translation in OpenNMT-py

谁都会走 提交于 2019-12-02 10:04:04
Does anyone know how to get the alignments weights when translating in Opennmt-py? Usually the only output are the resulting sentences and I have tried to find a debugging flag or similar for the attention weights. So far, I have been unsuccessful. You can get the attention matrices. Note that it is not the same as alignment which is a term from statistical (not neural) machine translation. There is a thread on github discussing it. Here is a snippet from the discussion. When you get the translations from the mode, the attentions are in the attn field. import onmt import onmt.io import onmt