OpenNMT Forum

Encoder Output (Embedding) from Trained OPENNMT-TF Model

Hi there,

I have a trained opennmt-tf model and would like to get the embedding of the input sequence, in other words, the outcome of the encoder. Is there an easy way to do this.

Thank you in advance.


You would need to edit the code. The encoder output is returned here:

If you want to write the embedding somewhere, you could add the encoder output in the predictions dictionary, and then update the method print_prediction.