Helsinki-NLP / Opus-MT

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

Unable to run using docker #14

Closed katphlab closed 4 years ago

katphlab commented 4 years ago

Hi, I've built Opus MT using docker when I try to run it, the following error shows up:

Starting opus-mt_opus-mt_1 ... done
Attaching to opus-mt_opus-mt_1
opus-mt_1  | Traceback (most recent call last):
opus-mt_1  |   File "server.py", line 150, in <module>
opus-mt_1  |     application = make_app(args)
opus-mt_1  |   File "server.py", line 130, in make_app
opus-mt_1  |     worker_pool = initialize_workers(services)
opus-mt_1  |   File "server.py", line 115, in initialize_workers
opus-mt_1  |     source_lang, target_lang, decoder_config)
opus-mt_1  |   File "server.py", line 26, in __init__
opus-mt_1  |     targetspm=self.service.get('targetspm')
opus-mt_1  |   File "/usr/src/app/content_processor.py", line 17, in __init__
opus-mt_1  |     BPEcodes = open(sourcebpe, 'r', encoding="utf-8")
opus-mt_1  | FileNotFoundError: [Errno 2] No such file or directory: './models/en-es/source.bpe'
opus-mt_opus-mt_1 exited with code 1

I've downloaded the pretrained models but it doesn't contain the bpe files only .npz files. Kindly help.

Thanks!!!

santhoshtr commented 4 years ago

You may need to edit the services.json https://github.com/Helsinki-NLP/Opus-MT/blob/master/services.json as per your models(add more languages or change the entries to point correct files)

katphlab commented 4 years ago

Yes, but the pre-trained models do not have the bpe files or the decoder.yml file, only .npz file. Can you refer me to some docs which can explain how to use a pre-trained model?

Thanks for the quick response.

santhoshtr commented 4 years ago

Please refer the entries in https://github.com/Helsinki-NLP/Opus-MT/blob/master/services.json - it has examples for both bpe and spm. https://object.pouta.csc.fi/OPUS-MT-models/en-es/opus-2019-12-04.zip has decoder.yaml with contents like:

models:
  - opus.bpe32k-bpe32k.enml.transformer.model1.npz.best-perplexity.npz
vocabs:
  - opus.bpe32k-bpe32k.enml.vocab.yml
  - opus.bpe32k-bpe32k.enml.vocab.yml
beam-size: 6
normalize: 1
word-penalty: 0
mini-batch: 1
maxi-batch: 1
maxi-batch-sort: src
relative-paths: true
katphlab commented 4 years ago

Thanks. The confusion was that files are present in the en-es and not es-en, resolved it. Same is true for rest of the models too.

jorgtied commented 4 years ago

I am a bit confused - do you mean that the pre-trained es-en model package does not have the bpe model files included? They should be there and I would need to check/fix this if they are not there ...

katphlab commented 4 years ago

I just downloaded the files again and it seems the files are indeed there. I had downloaded the same files a few days back and the files were not there.

jorgtied commented 4 years ago

Interesting. Well, good to know that this is fine. I'll close the issue again.