OpenNMT

Running two models at the same run

Hey,

In my research i am using OpenNMT and i would like to explore 2 stages translation.
the first model translates from a to b and the second one is learning how to correct the output (learns from b to b).
I would like to do that with OpenNMT but i do not see an easy way to do so (get the first model output and give it as input to the second one - or running to models in general).

Thank you,
Yuval Olshaker

How would you connect the two models? Latent space representations or simply though token sequences?
For the latter, you can probably just experiment chaining two translation calls in a bash script for instance.
If you want to use output representations of a model for another model’s input, you’ll have to adapt some parts. Some discussion about such setups started here: https://github.com/OpenNMT/OpenNMT-py/issues/1922

Thank you,
I do want to use output representations of a model for another model’s input.
the main issue I am facing is to get the length of the first model output.

is there an easy way to do so?

That’s a tough one indeed. You can’t really know the length of the decoded sequence prior to having fully generated it… Not sure how you would work that out.