From ac32d7a304783e56e2238c09227ea8f9e83bc981 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Wed, 29 Oct 2025 05:06:31 -0700 Subject: [PATCH] LibreTranslate: bump torch version (#8710) --- ct/libretranslate.sh | 17 ++++++++++------- install/libretranslate-install.sh | 11 ++++++++--- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ct/libretranslate.sh b/ct/libretranslate.sh index 9e41024fe..44a481565 100644 --- a/ct/libretranslate.sh +++ b/ct/libretranslate.sh @@ -28,21 +28,24 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi + + setup_uv + if check_for_gh_release "libretranslate" "LibreTranslate/LibreTranslate"; then - msg_info "Stopping $APP" + msg_info "Stopping Service" systemctl stop libretranslate - msg_ok "Stopped $APP" + msg_ok "Stopped Service" - msg_info "Updating $APP" + msg_info "Updating LibreTranslate" cd /opt/libretranslate source .venv/bin/activate $STD pip install -U libretranslate - msg_ok "Updated $APP" + msg_ok "Updated LibreTranslate" - msg_info "Starting $APP" + msg_info "Starting Service" systemctl start libretranslate - msg_ok "Started $APP" - msg_ok "Update Successful" + msg_ok "Started Service" + msg_ok "Update Successfully!" fi exit } diff --git a/install/libretranslate-install.sh b/install/libretranslate-install.sh index 79f2c6956..ef7d3eb01 100644 --- a/install/libretranslate-install.sh +++ b/install/libretranslate-install.sh @@ -14,9 +14,9 @@ network_check update_os msg_info "Installing dependencies" -$STD apt install -y --no-install-recommends \ +$STD apt install -y \ pkg-config \ - gcc \ + build-essentials \ g++ \ libicu-dev msg_ok "Installed dependencies" @@ -32,13 +32,18 @@ setup_uv fetch_and_deploy_gh_release "libretranslate" "LibreTranslate/LibreTranslate" msg_info "Setup LibreTranslate (Patience)" +TORCH_VERSION=$(grep -Eo '"torch ==[0-9]+\.[0-9]+\.[0-9]+' /opt/libretranslate/pyproject.toml | \ + tail -n1 | sed 's/.*==//') +if [[ -z "$TORCH_VERSION" ]]; then + TORCH_VERSION="2.5.0" +fi cd /opt/libretranslate $STD uv venv .venv $STD source .venv/bin/activate $STD uv pip install --upgrade pip setuptools $STD uv pip install Babel==2.12.1 $STD .venv/bin/python scripts/compile_locales.py -$STD uv pip install torch==2.2.0 --extra-index-url https://download.pytorch.org/whl/cpu +$STD uv pip install "torch==${TORCH_VERSION}" --extra-index-url https://download.pytorch.org/whl/cpu $STD uv pip install "numpy<2" $STD uv pip install . $STD uv pip install libretranslate