Helsinki-NLP / Opus-MT

Open neural machine translation models and web services
MIT License
592 stars 71 forks source link

convert pretrained models to nematus / tensorflow #18

Open lhk opened 4 years ago

lhk commented 4 years ago

Hi,

I'm looking for pretrained machine translation models in tensorflow. If I understand correctly, Opus-MT is based on marian-nmt, which in turn is a pure C++ implementation of nematus. Would it be possible to convert an Opus-MT model to tensorflow?

Please excuse this strange question. This is definitely not a preference for tensorflow, just for the sake of tensorflow. I would love to use Opus-MT. Your infrastructure and deployment options look super clean!

The reason I'm asking is that I'm looking for a way to deploy machine translation on the client-side. I've used tensorflow-js and tensorflow-lite before, for custom image analysis tasks on android/web. So with a pretrained tensorflow model, it should be quite straightforward to get it to run.

Then there would still be the text preprocessing/tokenization. But it seems that most Opus-MT models rely on sentencepiece. The python source is rather clean and I think I could get this ported to Typescript quickly.

jorgtied commented 4 years ago

The models in OPUS-MT may not be directly nematus compatible but that is something that you could ask at the marian-nmt mailing list. I am not aware of any conversion script that can convert it to any kind of tensorflow framework. However, I know that huggingface has made a recent effort to convert them to their transformers library (look at https://huggingface.co/Helsinki-NLP). This is still pyTorch but maube gives you a starting point anyway?

liyaodev commented 6 months ago

@lhk Hi, hello, I may have the same problem. Do you have a suitable solution for client deployment of machine translation to share later?