I want to install only spanish, so according to this link I tried:
libretranslate --load-only es
However, I’m met with a
Cannot update models (normal if you're offline): no available package
IndexError: list index out of range
How can I only install specific language models? Also where are the language models stored? I’m using a virtualenv to do this.
Should be:
libretranslate --load-only es,en
The relevant code is here:
unavailable_lang_codes -= {pack.from_code, pack.to_code}
if unavailable_lang_codes:
raise ValueError(
"Unavailable language codes: %s."
% ",".join(sorted(unavailable_lang_codes))
)
# Keep only the packages that have both from_code and to_code in our list.
available_packages = [
pack
for pack in available_packages
if pack.from_code in load_only_lang_codes and pack.to_code in load_only_lang_codes
]
if not available_packages:
raise ValueError("no available package")
print("Keep %s models" % len(available_packages))
# Download and install all available packages
for available_package in available_packages:
update = False
if not force:
for pack in installed_packages:
2 Likes
I will try that out. Thank you very much!
1 Like
Edit : Resolved, I used
libretranslate --load-only es,en --update-models
and it works great! Now I’m just wondering how to get rid of Albanian and Arabic since I don’t need those models.
well, now the server runs, but for some reason spanish doesn’t show up:
I suspect albanian and arabic are on there because I tried running it and then realized that it was going to install 86 languages, and since I didn’t need that many I terminated the program.
1 Like
You can uninstall Argos Translate packages using argostranslate.package.uninstall
https://argos-translate.readthedocs.io/en/latest/source/argostranslate.html#argostranslate.package.uninstall
import argostranslate
import argostranslate.package
def uninstall_argostranslate_package(from_code: str, to_code: str):
for pkg in argostranslate.package.get_installed_packages():
if pkg.from_code == from_code and pkg.to_code == to_code:
argostranslate.package.uninstall(pkg)
if __name__ == "__main__":
from_code = "en"
to_code = "it"
uninstall_argostranslate_package(from_code, to_code)
You can also delete the installed packages directly from you filesystem in ~/.local/share/argos-translate
:
(env) pj@pj-Latitude-5490:~/Desktop$ ls ~/.local/share/argos-translate/packages/
translate-cs_en-1_9 translate-en_cs-1_9
(env) pj@pj-Latitude-5490:~/Desktop$ rm ~/.local/share/argos-translate/packages/translate-en_cs-1_9/ -rf
(env) pj@pj-Latitude-5490:~/Desktop$ argospm list
translate-cs_en
1 Like
thank you so much! This worked perfectly!
1 Like