browsermt / bergamot-translator

Cross platform C++ library focusing on optimized machine translation on the consumer-grade device.
http://browser.mt
Mozilla Public License 2.0
341 stars 38 forks source link

Importing bergamot for Python fails without network connection. #430

Closed vgbundo closed 2 years ago

vgbundo commented 2 years ago

In python "import bergamot" fails if a network connection to the internet is unavailable. This occurs even if the model to be used is already available, such that it is not necessary to download anything to perform translation.

This occurs because TranslateLocallyLike.init() always calls TranslateLocallyLike.update() which attempts to fetch the latest "models.json" file from the internet.

jerinphilip commented 2 years ago

@vgbundo Thank you for the detailed report. I have pushed something which appears to be working for me locally. Let me know if this works for you. A wheel should be available at https://github.com/browsermt/bergamot-translator/releases/tag/latest. Might take a bit longer to hit PyPI.

The python package a voluntary contribution and could use support of the users. Please keep them reports coming for stuff you find during your usage, and feel free to take initiative to discuss possible improvements here and contribute towards the efforts.