How to extract the word embedding vector from a trained model?

I am using OpenNMT to train a NLP model for my task, and found it’s a great tool for research. Now I finished the training of model, and I want to extract the learned word embedding vectors for other task. Is this available in the case of OpenNMT, if so, how can I do to achieve it ?
Any advice would be appreciated !

I assume you are using the Lua version so you should take a look at the tools/extract_embeddings.lua script.

I am using the Pytorch version, but the answer is the same. Thank you for your reply !