argosopentech / LibreTranslate-init

Shell scripts to install LibreTranslate
MIT License
53 stars 16 forks source link

How can i run an update #13

Open poltrian opened 1 year ago

poltrian commented 1 year ago

it's possible to run an update with the script?

manuelkamp commented 1 year ago

I'd like to know that too

argosopentech commented 11 months ago

You can reinstall LibreTranslate and update the models:

cd ~/LibreTranslate-init
git pull
rm -rf ~/LibreTranslate/env
virtualenv ~/LibreTranslate/env
~/LibreTranslate/env/bin/pip install ~/LibreTranslate/ --no-cache-dir
~/LibreTranslate/env/bin/libretranslate --update-models

It would be good to add better built in support and or docs for updating.

aab3r commented 10 months ago

@argosopentech Looking a way to update, I've found this script. Thanks! However, I've seen that, as virtualenv is deleted, so is gunicorn. I've fixed it adding "~/LibreTranslate/env/bin/pip install gunicorn" after LibreTranslate install.

aab3r commented 2 months ago

Ok, it gets trickier...

I've been using that way of updating LibreTranslate without issues, but recently I've upgraded Debian (to bookworm version) and something makes LT not to work anymore. The update itself works, and the page loads, but as soon as some text is typed to be translated, systemctl status libretranslate.service says:


gunicorn: File "/home/libretranslate/LibreTranslate/env/lib/python3.11/site-packages/stanza/models/tokenize/utils.py", line 85, in output_predictions
     batch = data_generator.next(eval_offsets=offsets)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/libretranslate/LibreTranslate/env/lib/python3.11/site-packages/stanza/models/tokenize/data.py", line 206, in next
     units, labels, features = list(map(convert, [(units, np.int64), (labels, np.int64), (features, np.float32)]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/libretranslate/LibreTranslate/env/lib/python3.11/site-packages/stanza/models/tokenize/data.py", line 204, in <lambda>
     convert = lambda t: (torch.from_numpy(np.array(t[0], dtype=t[1])))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 RuntimeError: Numpy is not available

It seems related to the way Debian has changed the way of using "pip"; now "pipx" is recommended. Anyway, I've installed python3-numpy, and even "pipx install numpy", but the issue remains.

I'm willing to make more tests if someone can guide me in the right direction :)

PJ-Finlay commented 2 months ago

RuntimeError: Numpy is not available

I think this is a Numpy issue

https://github.com/LibreTranslate/LibreTranslate/issues/638

aab3r commented 2 months ago

That's right!

Adding "~/LibreTranslate/env/bin/pip install numpy==1.26.4 --force" at the end of the script fixes the issue.

Thanks!