LibreTranslate: bump torch version (#8710)

This commit is contained in:
CanbiZ
2025-10-29 05:06:31 -07:00
committed by GitHub
parent 3fe234b021
commit ac32d7a304
2 changed files with 18 additions and 10 deletions

View File

@@ -28,21 +28,24 @@ function update_script() {
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
if check_for_gh_release "libretranslate" "LibreTranslate/LibreTranslate"; then
msg_info "Stopping $APP"
systemctl stop libretranslate
msg_ok "Stopped $APP"
msg_info "Updating $APP" setup_uv
if check_for_gh_release "libretranslate" "LibreTranslate/LibreTranslate"; then
msg_info "Stopping Service"
systemctl stop libretranslate
msg_ok "Stopped Service"
msg_info "Updating LibreTranslate"
cd /opt/libretranslate cd /opt/libretranslate
source .venv/bin/activate source .venv/bin/activate
$STD pip install -U libretranslate $STD pip install -U libretranslate
msg_ok "Updated $APP" msg_ok "Updated LibreTranslate"
msg_info "Starting $APP" msg_info "Starting Service"
systemctl start libretranslate systemctl start libretranslate
msg_ok "Started $APP" msg_ok "Started Service"
msg_ok "Update Successful" msg_ok "Update Successfully!"
fi fi
exit exit
} }

View File

@@ -14,9 +14,9 @@ network_check
update_os update_os
msg_info "Installing dependencies" msg_info "Installing dependencies"
$STD apt install -y --no-install-recommends \ $STD apt install -y \
pkg-config \ pkg-config \
gcc \ build-essentials \
g++ \ g++ \
libicu-dev libicu-dev
msg_ok "Installed dependencies" msg_ok "Installed dependencies"
@@ -32,13 +32,18 @@ setup_uv
fetch_and_deploy_gh_release "libretranslate" "LibreTranslate/LibreTranslate" fetch_and_deploy_gh_release "libretranslate" "LibreTranslate/LibreTranslate"
msg_info "Setup LibreTranslate (Patience)" 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 cd /opt/libretranslate
$STD uv venv .venv $STD uv venv .venv
$STD source .venv/bin/activate $STD source .venv/bin/activate
$STD uv pip install --upgrade pip setuptools $STD uv pip install --upgrade pip setuptools
$STD uv pip install Babel==2.12.1 $STD uv pip install Babel==2.12.1
$STD .venv/bin/python scripts/compile_locales.py $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 "numpy<2"
$STD uv pip install . $STD uv pip install .
$STD uv pip install libretranslate $STD uv pip install libretranslate