OpenNMT Forum

About Opennmt-tf 1.25.3 output of exported models

Hi, I am using Opennmt-tf 1.25.3 to do a translate task.

The model (a standard transformer) is trained. Exported model serving is great. Thanks for the awesome project.

Now I want to do a minor (but seems not that easy) modification. I want the exported model to provide the output of last encoder layer, too. What are changes of code I should make to to achieve this?

Thank you very much!

Hi,

Here is the output dictionary that is returned by the exported model:

You can add other tensors in it. In particular, you can find encoder_outputs higher up in the same function.

Once the code is updated, you should re-export your model.

Thank you! I solved the problem with your help, really appreciated.