0

The documentation only mentions using the command line to run the translate.py script already given in the OpenNMT-py repo, i.e. use

python translate.py -model model_name.pt -src data/src-test.txt -output pred.txt

and that's fine, but how do I use the onmt library to load the trained 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!

charmander
  • 957
  • 1
  • 8
  • 21
  • you should probably look within the `python translate.py` file on how they do – Cedias Mar 27 '19 at 20:32
  • You might want to create a REST translation server. OpenNMT forum has a detailed tutorial: http://forum.opennmt.net/t/simple-opennmt-py-rest-server/1392] – GoTrained May 21 '19 at 06:38

0 Answers0