OpenNMT Forum

How to translate a sentence using jupyter notebook?

opennmt-py
(charmander) #1

Hello,

I’m trying to use the onmt library to load a trained OpenNMT-py model in a jupyter notebook and make translations on the go. I want it to be able to do something like this in jupyter:

model = onmt.module.load(/path/to/model.pt)
text = "hola como estas"
model.translate(text)

Output:
Hello how are you

I can’t find any documentation on how to do this. Please help!

0 Likes

(Guillaume Klein) #2

Hi,

Did you take a look at this documentation?

http://opennmt.net/OpenNMT-py/Library.html

There is a section for translation.

0 Likes