OpenNMT Forum

Attention from Scripted OpenNMT

Hello! I trying to translate between spanish and english parallel sentences with just scripting and configuing a YAML file, very similar to how it’s done in the “Translation” example in the docs. However, during translation, I want to be able to see the outputs and the attention that the model used. I know this might be possible using the API, but is this possible just using scripting configuration? Someone told me it was possible from the command line. Maybe OpenNMT doesn’t have this feature but something else does? Urgent help would be appreciated!

You might want to try the attn_debug flag.

Can you elaborate more in how I would set this? I see something related to “translate.py” but I how do I set that up? Thanks

You want to use scripts only. The only way to translate this way is the translate.py script. attn_debug is a flag for this script. Try to execute it with this flag, and you’ll see if it suits your needs or not.

1 Like