Dataframe as output instead of file for opennmt-py translate


(bhagyashree) #1

Hello,

I have a trained model using opennmt-py and currently use the quickstart command to translate.
$python translate.py -model demo-model_XYZ.pt …

Is there any way to pass this model through a python function instead? I also want to get output data in a dataframe instead of an output file… Is there a preexisting wrapper or some example?

I looked through the docs and onmt.translate.Translator seems to take the model as input… but I cannot find any function to load the the model from .pt file in the format of onmt.translate.Translator function.

For the output data, I couldnt identify where the file is being written.

Thanks!
Bee