From bc6db065a09ba9cc29e22735a65217fee56e1cbf Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:39:59 +0100 Subject: [PATCH 01/18] feat: add Immich Remote ML CT script --- ct/immich-remote-ml.sh | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 ct/immich-remote-ml.sh diff --git a/ct/immich-remote-ml.sh b/ct/immich-remote-ml.sh new file mode 100644 index 0000000000..61a8da0365 --- /dev/null +++ b/ct/immich-remote-ml.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: jwklijnsma (jwklijnsma) +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://immich.app | https://github.com/immich-app/immich + +APP="Immich Remote ML" +var_tags="${var_tags:-photos;ai}" +var_cpu="${var_cpu:-6}" +var_ram="${var_ram:-12288}" +var_disk="${var_disk:-50}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_arm64="${var_arm64:-no}" # ROCm and Immich's ROCm ONNX Runtime are amd64-only. +var_unprivileged="${var_unprivileged:-1}" +var_gpu="${var_gpu:-yes}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + local APP_DIR="/opt/immich-remote-ml" + local DATA_DIR="/opt/immich-remote-ml_data" + local ML_SOURCE_DIR="${APP_DIR}/machine-learning" + local VENV_DIR="${DATA_DIR}/venv" + + if [[ ! -d "$ML_SOURCE_DIR" ]]; then + msg_error "No ${APP} installation found!" + exit + fi + + if check_for_gh_release "immich-remote-ml" "immich-app/immich"; then + msg_info "Stopping ${APP}" + systemctl stop immich-remote-ml + msg_ok "Stopped ${APP}" + + set -a + source /etc/default/immich-remote-ml + set +a + + msg_info "Updating ${APP}" + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "immich-remote-ml" "immich-app/immich" "tarball" "latest" "$APP_DIR" + UV_PROJECT_ENVIRONMENT="$VENV_DIR" $STD uv sync --project "$ML_SOURCE_DIR" --locked --no-dev --no-install-project --extra "${ML_EXTRA:-cpu}" --python 3.13 --link-mode copy + msg_ok "Updated ${APP}" + + msg_info "Starting ${APP}" + safe_service_restart "immich-remote-ml" + msg_ok "Started ${APP}" + fi + exit +} From 990c8f57650b99fee4b110670f5984a557afb35d Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:40:02 +0100 Subject: [PATCH 02/18] feat: add native Immich Remote ML installer --- install/immich-remote-ml-install.sh | 97 +++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 install/immich-remote-ml-install.sh diff --git a/install/immich-remote-ml-install.sh b/install/immich-remote-ml-install.sh new file mode 100644 index 0000000000..7380a9c5f5 --- /dev/null +++ b/install/immich-remote-ml-install.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash +source "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +APP="Immich Remote ML" +APP_DIR="/opt/immich-remote-ml" +DATA_DIR="/opt/immich-remote-ml_data" +ML_SOURCE_DIR="${APP_DIR}/machine-learning" +VENV_DIR="${DATA_DIR}/venv" +CACHE_DIR="${DATA_DIR}/cache" +HOME_DIR="${DATA_DIR}/home" + +$STD apt install -y g++ git + +PYTHON_VERSION="3.13" setup_uv +setup_hwaccel + +fetch_and_deploy_gh_release "immich-remote-ml" "immich-app/immich" "tarball" "latest" "$APP_DIR" + +if [[ "${HWACCEL_VENDOR:-none}" == "amd" ]]; then + ML_EXTRA="rocm" + DEVICE="rocm" + $STD apt install -y rocm-hip-libraries rocm-ml-libraries + msg_ok "AMD ROCm machine-learning backend selected" +else + ML_EXTRA="cpu" + DEVICE="cpu" + msg_warn "No AMD GPU passthrough detected; using the CPU machine-learning backend" +fi + +mkdir -p "$DATA_DIR" "$CACHE_DIR" "$HOME_DIR" "$VENV_DIR" + +cat </etc/default/immich-remote-ml +ML_EXTRA=$ML_EXTRA +DEVICE=$DEVICE +# For unsupported gfx1030 GPUs, uncomment the following overrides if ROCm reports an architecture error. +# HSA_OVERRIDE_GFX_VERSION=10.3.0 +# HSA_USE_SVM=0 +EOF + +UV_PROJECT_ENVIRONMENT="$VENV_DIR" $STD uv sync --project "$ML_SOURCE_DIR" --locked --no-dev --no-install-project --extra "$ML_EXTRA" --python 3.13 --link-mode copy + +cat </etc/systemd/system/immich-remote-ml.service +[Unit] +Description=Immich Remote Machine Learning +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +WorkingDirectory=$ML_SOURCE_DIR +EnvironmentFile=-/etc/default/immich-remote-ml +Environment=HOME=$HOME_DIR +Environment=IMMICH_HOST=0.0.0.0 +Environment=IMMICH_PORT=3003 +Environment=MACHINE_LEARNING_CACHE_FOLDER=$CACHE_DIR +Environment=MACHINE_LEARNING_MODEL_ARENA=false +ExecStart=$VENV_DIR/bin/gunicorn immich_ml.main:app -k immich_ml.config.CustomUvicornWorker -c immich_ml/gunicorn_conf.py -b 0.0.0.0:3003 -w 1 -t 300 --log-config-json log_conf.json --keep-alive 2 --graceful-timeout 10 --no-control-socket +Restart=on-failure +RestartSec=5 +TimeoutStartSec=300 +TimeoutStopSec=30 +PrivateTmp=true +PrivateDevices=false +ProtectSystem=strict +ProtectHome=true +ProtectKernelTunables=true +ProtectKernelModules=true +ProtectControlGroups=true +NoNewPrivileges=true +RestrictSUIDSGID=true +LockPersonality=true +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +ReadWritePaths=$DATA_DIR + +[Install] +WantedBy=multi-user.target +EOF + +systemctl enable --now immich-remote-ml.service + +if systemctl is-active --quiet immich-remote-ml.service; then + msg_ok "Immich Remote ML is listening on TCP port 3003" +else + journalctl -u immich-remote-ml.service -n 50 --no-pager + msg_error "Immich Remote ML failed to start" + exit 1 +fi + +motd_ssh +customize +cleanup_lxc From b2eb61ff4aeaa3e03a7ca73b70bbc0549f812bd3 Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:40:04 +0100 Subject: [PATCH 03/18] feat: add Immich Remote ML metadata --- json/immich-remote-ml.json | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 json/immich-remote-ml.json diff --git a/json/immich-remote-ml.json b/json/immich-remote-ml.json new file mode 100644 index 0000000000..0a2c9b5d18 --- /dev/null +++ b/json/immich-remote-ml.json @@ -0,0 +1,40 @@ +{ + "name": "Immich Remote ML", + "slug": "immich-remote-ml", + "categories": [20], + "date_created": "2026-11-25", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 3003, + "documentation": "https://docs.immich.app/features/ml-hardware-acceleration/", + "website": "https://immich.app/", + "repository": "https://github.com/immich-app/immich", + "architectures": ["amd64"], + "platforms": ["pve"], + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/immich.webp", + "description": "Standalone native Immich machine-learning service for facial recognition and smart search. Uses AMD ROCm when an AMD GPU is passed through to the LXC, with a CPU fallback.", + "install_methods": [ + { + "type": "default", + "script": "ct/immich-remote-ml.sh", + "config_path": "/etc/default/immich-remote-ml", + "resources": { + "cpu": 6, + "ram": 12288, + "hdd": 50, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + "In Immich, set the Machine Learning URL to http://:3003. The API has no authentication; restrict TCP port 3003 to the Immich server and trusted LAN.", + "ROCm requires AMD GPU passthrough and a compatible Proxmox host driver. For unsupported gfx1030 devices, set HSA_OVERRIDE_GFX_VERSION=10.3.0 in /etc/default/immich-remote-ml.", + "ROCm libraries and model caches require substantial disk space; the default LXC disk is 50 GiB. CPU backend is selected when no AMD GPU is detected." + ] +} \ No newline at end of file From 6f5ba1c6053f1cd07c5e1a873f24f59d751d7253 Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:44:41 +0100 Subject: [PATCH 04/18] fix: add CT script base and completion footer --- ct/immich-remote-ml.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ct/immich-remote-ml.sh b/ct/immich-remote-ml.sh index 61a8da0365..3c5abb9def 100644 --- a/ct/immich-remote-ml.sh +++ b/ct/immich-remote-ml.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main" _cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") @@ -58,3 +59,12 @@ function update_script() { fi exit } + +start +build_container +description + +msg_ok "Completed Successfully!\\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW}Immich Machine Learning API is available at:${CL}" +echo -e "${GATEWAY}${BGN}http://${IP}:3003${CL}" From b594b6e0dc7256ab77b7a41be9da613049bd246a Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:44:58 +0100 Subject: [PATCH 05/18] fix: use Immich ROCm runtime dependencies --- install/immich-remote-ml-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/immich-remote-ml-install.sh b/install/immich-remote-ml-install.sh index 7380a9c5f5..a8cdd75b02 100644 --- a/install/immich-remote-ml-install.sh +++ b/install/immich-remote-ml-install.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source "$FUNCTIONS_FILE_PATH" +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" color verb_ip6 catch_errors @@ -25,7 +25,7 @@ fetch_and_deploy_gh_release "immich-remote-ml" "immich-app/immich" "tarball" "la if [[ "${HWACCEL_VENDOR:-none}" == "amd" ]]; then ML_EXTRA="rocm" DEVICE="rocm" - $STD apt install -y rocm-hip-libraries rocm-ml-libraries + $STD apt install -y migraphx miopen-hip msg_ok "AMD ROCm machine-learning backend selected" else ML_EXTRA="cpu" From 6bef1b4fcc999321704261dc2d1f81015b689410 Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:45:20 +0100 Subject: [PATCH 06/18] fix: use standard CT completion message --- ct/immich-remote-ml.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/immich-remote-ml.sh b/ct/immich-remote-ml.sh index 3c5abb9def..e872ac443e 100644 --- a/ct/immich-remote-ml.sh +++ b/ct/immich-remote-ml.sh @@ -64,7 +64,7 @@ start build_container description -msg_ok "Completed Successfully!\\n" +msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${INFO}${YW}Immich Machine Learning API is available at:${CL}" echo -e "${GATEWAY}${BGN}http://${IP}:3003${CL}" From f93415ffdfdd51f82d80d33fb18630dc8d812762 Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:45:22 +0100 Subject: [PATCH 07/18] fix: install Immich ROCm runtime libraries From f355bcd937e189c5c3f002684a2f938003cac29d Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:46:35 +0100 Subject: [PATCH 08/18] fix: launch Immich ML with upstream module entrypoint --- install/immich-remote-ml-install.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/install/immich-remote-ml-install.sh b/install/immich-remote-ml-install.sh index a8cdd75b02..0015c3a78a 100644 --- a/install/immich-remote-ml-install.sh +++ b/install/immich-remote-ml-install.sh @@ -33,7 +33,7 @@ else msg_warn "No AMD GPU passthrough detected; using the CPU machine-learning backend" fi -mkdir -p "$DATA_DIR" "$CACHE_DIR" "$HOME_DIR" "$VENV_DIR" +mkdir -p "$DATA_DIR" "$CACHE_DIR/jit/comgr" "$CACHE_DIR/hf-cache" "$HOME_DIR" "$VENV_DIR" cat </etc/default/immich-remote-ml ML_EXTRA=$ML_EXTRA @@ -56,11 +56,14 @@ Type=simple WorkingDirectory=$ML_SOURCE_DIR EnvironmentFile=-/etc/default/immich-remote-ml Environment=HOME=$HOME_DIR +Environment=PATH=$VENV_DIR/bin:/opt/rocm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin Environment=IMMICH_HOST=0.0.0.0 Environment=IMMICH_PORT=3003 Environment=MACHINE_LEARNING_CACHE_FOLDER=$CACHE_DIR -Environment=MACHINE_LEARNING_MODEL_ARENA=false -ExecStart=$VENV_DIR/bin/gunicorn immich_ml.main:app -k immich_ml.config.CustomUvicornWorker -c immich_ml/gunicorn_conf.py -b 0.0.0.0:3003 -w 1 -t 300 --log-config-json log_conf.json --keep-alive 2 --graceful-timeout 10 --no-control-socket +Environment=MACHINE_LEARNING_MODEL_REVISION=v2 +Environment=HF_HOME=$CACHE_DIR/hf-cache +Environment=AMD_COMGR_CACHE_DIR=$CACHE_DIR/jit/comgr +ExecStart=$VENV_DIR/bin/python -m immich_ml Restart=on-failure RestartSec=5 TimeoutStartSec=300 From c5ad757934aafaa0cc2defbdaf430fe08cdd03b7 Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:52:17 +0100 Subject: [PATCH 09/18] fix: match normalized Immich installer filename --- install/immichremoteml-install.sh | 100 ++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 install/immichremoteml-install.sh diff --git a/install/immichremoteml-install.sh b/install/immichremoteml-install.sh new file mode 100644 index 0000000000..0015c3a78a --- /dev/null +++ b/install/immichremoteml-install.sh @@ -0,0 +1,100 @@ +#!/usr/bin/env bash +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +APP="Immich Remote ML" +APP_DIR="/opt/immich-remote-ml" +DATA_DIR="/opt/immich-remote-ml_data" +ML_SOURCE_DIR="${APP_DIR}/machine-learning" +VENV_DIR="${DATA_DIR}/venv" +CACHE_DIR="${DATA_DIR}/cache" +HOME_DIR="${DATA_DIR}/home" + +$STD apt install -y g++ git + +PYTHON_VERSION="3.13" setup_uv +setup_hwaccel + +fetch_and_deploy_gh_release "immich-remote-ml" "immich-app/immich" "tarball" "latest" "$APP_DIR" + +if [[ "${HWACCEL_VENDOR:-none}" == "amd" ]]; then + ML_EXTRA="rocm" + DEVICE="rocm" + $STD apt install -y migraphx miopen-hip + msg_ok "AMD ROCm machine-learning backend selected" +else + ML_EXTRA="cpu" + DEVICE="cpu" + msg_warn "No AMD GPU passthrough detected; using the CPU machine-learning backend" +fi + +mkdir -p "$DATA_DIR" "$CACHE_DIR/jit/comgr" "$CACHE_DIR/hf-cache" "$HOME_DIR" "$VENV_DIR" + +cat </etc/default/immich-remote-ml +ML_EXTRA=$ML_EXTRA +DEVICE=$DEVICE +# For unsupported gfx1030 GPUs, uncomment the following overrides if ROCm reports an architecture error. +# HSA_OVERRIDE_GFX_VERSION=10.3.0 +# HSA_USE_SVM=0 +EOF + +UV_PROJECT_ENVIRONMENT="$VENV_DIR" $STD uv sync --project "$ML_SOURCE_DIR" --locked --no-dev --no-install-project --extra "$ML_EXTRA" --python 3.13 --link-mode copy + +cat </etc/systemd/system/immich-remote-ml.service +[Unit] +Description=Immich Remote Machine Learning +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +WorkingDirectory=$ML_SOURCE_DIR +EnvironmentFile=-/etc/default/immich-remote-ml +Environment=HOME=$HOME_DIR +Environment=PATH=$VENV_DIR/bin:/opt/rocm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +Environment=IMMICH_HOST=0.0.0.0 +Environment=IMMICH_PORT=3003 +Environment=MACHINE_LEARNING_CACHE_FOLDER=$CACHE_DIR +Environment=MACHINE_LEARNING_MODEL_REVISION=v2 +Environment=HF_HOME=$CACHE_DIR/hf-cache +Environment=AMD_COMGR_CACHE_DIR=$CACHE_DIR/jit/comgr +ExecStart=$VENV_DIR/bin/python -m immich_ml +Restart=on-failure +RestartSec=5 +TimeoutStartSec=300 +TimeoutStopSec=30 +PrivateTmp=true +PrivateDevices=false +ProtectSystem=strict +ProtectHome=true +ProtectKernelTunables=true +ProtectKernelModules=true +ProtectControlGroups=true +NoNewPrivileges=true +RestrictSUIDSGID=true +LockPersonality=true +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +ReadWritePaths=$DATA_DIR + +[Install] +WantedBy=multi-user.target +EOF + +systemctl enable --now immich-remote-ml.service + +if systemctl is-active --quiet immich-remote-ml.service; then + msg_ok "Immich Remote ML is listening on TCP port 3003" +else + journalctl -u immich-remote-ml.service -n 50 --no-pager + msg_error "Immich Remote ML failed to start" + exit 1 +fi + +motd_ssh +customize +cleanup_lxc From 9c0d5ec50ee123d61e6abbcb1dc8af3f592df7e9 Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:52:19 +0100 Subject: [PATCH 10/18] fix: remove incorrectly named Immich installer --- install/immich-remote-ml-install.sh | 100 ---------------------------- 1 file changed, 100 deletions(-) delete mode 100644 install/immich-remote-ml-install.sh diff --git a/install/immich-remote-ml-install.sh b/install/immich-remote-ml-install.sh deleted file mode 100644 index 0015c3a78a..0000000000 --- a/install/immich-remote-ml-install.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env bash -source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" -color -verb_ip6 -catch_errors -setting_up_container -network_check -update_os - -APP="Immich Remote ML" -APP_DIR="/opt/immich-remote-ml" -DATA_DIR="/opt/immich-remote-ml_data" -ML_SOURCE_DIR="${APP_DIR}/machine-learning" -VENV_DIR="${DATA_DIR}/venv" -CACHE_DIR="${DATA_DIR}/cache" -HOME_DIR="${DATA_DIR}/home" - -$STD apt install -y g++ git - -PYTHON_VERSION="3.13" setup_uv -setup_hwaccel - -fetch_and_deploy_gh_release "immich-remote-ml" "immich-app/immich" "tarball" "latest" "$APP_DIR" - -if [[ "${HWACCEL_VENDOR:-none}" == "amd" ]]; then - ML_EXTRA="rocm" - DEVICE="rocm" - $STD apt install -y migraphx miopen-hip - msg_ok "AMD ROCm machine-learning backend selected" -else - ML_EXTRA="cpu" - DEVICE="cpu" - msg_warn "No AMD GPU passthrough detected; using the CPU machine-learning backend" -fi - -mkdir -p "$DATA_DIR" "$CACHE_DIR/jit/comgr" "$CACHE_DIR/hf-cache" "$HOME_DIR" "$VENV_DIR" - -cat </etc/default/immich-remote-ml -ML_EXTRA=$ML_EXTRA -DEVICE=$DEVICE -# For unsupported gfx1030 GPUs, uncomment the following overrides if ROCm reports an architecture error. -# HSA_OVERRIDE_GFX_VERSION=10.3.0 -# HSA_USE_SVM=0 -EOF - -UV_PROJECT_ENVIRONMENT="$VENV_DIR" $STD uv sync --project "$ML_SOURCE_DIR" --locked --no-dev --no-install-project --extra "$ML_EXTRA" --python 3.13 --link-mode copy - -cat </etc/systemd/system/immich-remote-ml.service -[Unit] -Description=Immich Remote Machine Learning -After=network-online.target -Wants=network-online.target - -[Service] -Type=simple -WorkingDirectory=$ML_SOURCE_DIR -EnvironmentFile=-/etc/default/immich-remote-ml -Environment=HOME=$HOME_DIR -Environment=PATH=$VENV_DIR/bin:/opt/rocm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -Environment=IMMICH_HOST=0.0.0.0 -Environment=IMMICH_PORT=3003 -Environment=MACHINE_LEARNING_CACHE_FOLDER=$CACHE_DIR -Environment=MACHINE_LEARNING_MODEL_REVISION=v2 -Environment=HF_HOME=$CACHE_DIR/hf-cache -Environment=AMD_COMGR_CACHE_DIR=$CACHE_DIR/jit/comgr -ExecStart=$VENV_DIR/bin/python -m immich_ml -Restart=on-failure -RestartSec=5 -TimeoutStartSec=300 -TimeoutStopSec=30 -PrivateTmp=true -PrivateDevices=false -ProtectSystem=strict -ProtectHome=true -ProtectKernelTunables=true -ProtectKernelModules=true -ProtectControlGroups=true -NoNewPrivileges=true -RestrictSUIDSGID=true -LockPersonality=true -RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 -ReadWritePaths=$DATA_DIR - -[Install] -WantedBy=multi-user.target -EOF - -systemctl enable --now immich-remote-ml.service - -if systemctl is-active --quiet immich-remote-ml.service; then - msg_ok "Immich Remote ML is listening on TCP port 3003" -else - journalctl -u immich-remote-ml.service -n 50 --no-pager - msg_error "Immich Remote ML failed to start" - exit 1 -fi - -motd_ssh -customize -cleanup_lxc From 25b21e038827b036b62e5bc744492fcf019ae8eb Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 20:02:41 +0100 Subject: [PATCH 11/18] fix(immich): align CT script filename with normalized app slug --- ct/immichremoteml.sh | 70 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 ct/immichremoteml.sh diff --git a/ct/immichremoteml.sh b/ct/immichremoteml.sh new file mode 100644 index 0000000000..e872ac443e --- /dev/null +++ b/ct/immichremoteml.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main" +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: jwklijnsma (jwklijnsma) +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://immich.app | https://github.com/immich-app/immich + +APP="Immich Remote ML" +var_tags="${var_tags:-photos;ai}" +var_cpu="${var_cpu:-6}" +var_ram="${var_ram:-12288}" +var_disk="${var_disk:-50}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_arm64="${var_arm64:-no}" # ROCm and Immich's ROCm ONNX Runtime are amd64-only. +var_unprivileged="${var_unprivileged:-1}" +var_gpu="${var_gpu:-yes}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + local APP_DIR="/opt/immich-remote-ml" + local DATA_DIR="/opt/immich-remote-ml_data" + local ML_SOURCE_DIR="${APP_DIR}/machine-learning" + local VENV_DIR="${DATA_DIR}/venv" + + if [[ ! -d "$ML_SOURCE_DIR" ]]; then + msg_error "No ${APP} installation found!" + exit + fi + + if check_for_gh_release "immich-remote-ml" "immich-app/immich"; then + msg_info "Stopping ${APP}" + systemctl stop immich-remote-ml + msg_ok "Stopped ${APP}" + + set -a + source /etc/default/immich-remote-ml + set +a + + msg_info "Updating ${APP}" + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "immich-remote-ml" "immich-app/immich" "tarball" "latest" "$APP_DIR" + UV_PROJECT_ENVIRONMENT="$VENV_DIR" $STD uv sync --project "$ML_SOURCE_DIR" --locked --no-dev --no-install-project --extra "${ML_EXTRA:-cpu}" --python 3.13 --link-mode copy + msg_ok "Updated ${APP}" + + msg_info "Starting ${APP}" + safe_service_restart "immich-remote-ml" + msg_ok "Started ${APP}" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW}Immich Machine Learning API is available at:${CL}" +echo -e "${GATEWAY}${BGN}http://${IP}:3003${CL}" From 799b85f3700e64890505db18f2cb07091dbd55f7 Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 20:02:44 +0100 Subject: [PATCH 12/18] fix(immich): update metadata to normalized CT script path --- json/immich-remote-ml.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json/immich-remote-ml.json b/json/immich-remote-ml.json index 0a2c9b5d18..b609b2e311 100644 --- a/json/immich-remote-ml.json +++ b/json/immich-remote-ml.json @@ -17,7 +17,7 @@ "install_methods": [ { "type": "default", - "script": "ct/immich-remote-ml.sh", + "script": "ct/immichremoteml.sh", "config_path": "/etc/default/immich-remote-ml", "resources": { "cpu": 6, From 02e0e844bad823b3f1c6c8ababda8d45f28a73d0 Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 20:02:46 +0100 Subject: [PATCH 13/18] fix(immich): remove incorrectly named CT script --- ct/immich-remote-ml.sh | 70 ------------------------------------------ 1 file changed, 70 deletions(-) delete mode 100644 ct/immich-remote-ml.sh diff --git a/ct/immich-remote-ml.sh b/ct/immich-remote-ml.sh deleted file mode 100644 index e872ac443e..0000000000 --- a/ct/immich-remote-ml.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env bash -_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main" -_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" -source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") - -# Copyright (c) 2021-2026 community-scripts ORG -# Author: jwklijnsma (jwklijnsma) -# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE -# Source: https://immich.app | https://github.com/immich-app/immich - -APP="Immich Remote ML" -var_tags="${var_tags:-photos;ai}" -var_cpu="${var_cpu:-6}" -var_ram="${var_ram:-12288}" -var_disk="${var_disk:-50}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" -var_arm64="${var_arm64:-no}" # ROCm and Immich's ROCm ONNX Runtime are amd64-only. -var_unprivileged="${var_unprivileged:-1}" -var_gpu="${var_gpu:-yes}" - -header_info "$APP" -variables -color -catch_errors - -function update_script() { - header_info - check_container_storage - check_container_resources - - local APP_DIR="/opt/immich-remote-ml" - local DATA_DIR="/opt/immich-remote-ml_data" - local ML_SOURCE_DIR="${APP_DIR}/machine-learning" - local VENV_DIR="${DATA_DIR}/venv" - - if [[ ! -d "$ML_SOURCE_DIR" ]]; then - msg_error "No ${APP} installation found!" - exit - fi - - if check_for_gh_release "immich-remote-ml" "immich-app/immich"; then - msg_info "Stopping ${APP}" - systemctl stop immich-remote-ml - msg_ok "Stopped ${APP}" - - set -a - source /etc/default/immich-remote-ml - set +a - - msg_info "Updating ${APP}" - CLEAN_INSTALL=1 fetch_and_deploy_gh_release "immich-remote-ml" "immich-app/immich" "tarball" "latest" "$APP_DIR" - UV_PROJECT_ENVIRONMENT="$VENV_DIR" $STD uv sync --project "$ML_SOURCE_DIR" --locked --no-dev --no-install-project --extra "${ML_EXTRA:-cpu}" --python 3.13 --link-mode copy - msg_ok "Updated ${APP}" - - msg_info "Starting ${APP}" - safe_service_restart "immich-remote-ml" - msg_ok "Started ${APP}" - fi - exit -} - -start -build_container -description - -msg_ok "Completed Successfully!\n" -echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" -echo -e "${INFO}${YW}Immich Machine Learning API is available at:${CL}" -echo -e "${GATEWAY}${BGN}http://${IP}:3003${CL}" From c9d1fb295ce19d17ad2570180a76e66416f40cf9 Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 20:13:05 +0100 Subject: [PATCH 14/18] fix(immich-remote-ml): allow uv-managed Python in service sandbox --- install/immichremoteml-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/immichremoteml-install.sh b/install/immichremoteml-install.sh index 0015c3a78a..4a11871092 100644 --- a/install/immichremoteml-install.sh +++ b/install/immichremoteml-install.sh @@ -71,7 +71,7 @@ TimeoutStopSec=30 PrivateTmp=true PrivateDevices=false ProtectSystem=strict -ProtectHome=true +ProtectHome=read-only ProtectKernelTunables=true ProtectKernelModules=true ProtectControlGroups=true From 559d9c3cf53fe52e28aa6cb99dbf7ac7b4e310e0 Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 20:40:00 +0100 Subject: [PATCH 15/18] feat(immich-remote-ml): add NVIDIA CUDA backend --- install/immichremoteml-install.sh | 41 +++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/install/immichremoteml-install.sh b/install/immichremoteml-install.sh index 4a11871092..6ba27835f5 100644 --- a/install/immichremoteml-install.sh +++ b/install/immichremoteml-install.sh @@ -18,22 +18,31 @@ HOME_DIR="${DATA_DIR}/home" $STD apt install -y g++ git PYTHON_VERSION="3.13" setup_uv -setup_hwaccel +# Let the shared helper install userspace libraries matching the Proxmox host driver. +INSTALL_NVIDIA_DRIVERS=yes setup_hwaccel fetch_and_deploy_gh_release "immich-remote-ml" "immich-app/immich" "tarball" "latest" "$APP_DIR" -if [[ "${HWACCEL_VENDOR:-none}" == "amd" ]]; then - ML_EXTRA="rocm" - DEVICE="rocm" - $STD apt install -y migraphx miopen-hip - msg_ok "AMD ROCm machine-learning backend selected" -else - ML_EXTRA="cpu" - DEVICE="cpu" - msg_warn "No AMD GPU passthrough detected; using the CPU machine-learning backend" -fi +case "${HWACCEL_VENDOR:-none}" in + amd) + ML_EXTRA="rocm" + DEVICE="rocm" + $STD apt install -y migraphx miopen-hip + msg_ok "AMD ROCm machine-learning backend selected" + ;; + nvidia) + ML_EXTRA="cuda" + DEVICE="cuda" + msg_ok "NVIDIA CUDA machine-learning backend selected" + ;; + *) + ML_EXTRA="cpu" + DEVICE="cpu" + msg_warn "No supported GPU passthrough detected; using the CPU machine-learning backend" + ;; +esac -mkdir -p "$DATA_DIR" "$CACHE_DIR/jit/comgr" "$CACHE_DIR/hf-cache" "$HOME_DIR" "$VENV_DIR" +mkdir -p "$DATA_DIR" "$CACHE_DIR/jit/comgr" "$CACHE_DIR/jit/cuda" "$CACHE_DIR/hf-cache" "$HOME_DIR" "$VENV_DIR" cat </etc/default/immich-remote-ml ML_EXTRA=$ML_EXTRA @@ -43,7 +52,12 @@ DEVICE=$DEVICE # HSA_USE_SVM=0 EOF -UV_PROJECT_ENVIRONMENT="$VENV_DIR" $STD uv sync --project "$ML_SOURCE_DIR" --locked --no-dev --no-install-project --extra "$ML_EXTRA" --python 3.13 --link-mode copy +UV_SYNC_ARGS=(--project "$ML_SOURCE_DIR" --locked --no-dev --no-install-project --extra "$ML_EXTRA" --python 3.13 --link-mode copy) +if [[ "$ML_EXTRA" == "cuda" ]]; then + # Immich's CUDA runtime libraries are separate from the ONNX Runtime CUDA extra. + UV_SYNC_ARGS+=(--group cuda-libs) +fi +UV_PROJECT_ENVIRONMENT="$VENV_DIR" $STD uv sync "${UV_SYNC_ARGS[@]}" cat </etc/systemd/system/immich-remote-ml.service [Unit] @@ -63,6 +77,7 @@ Environment=MACHINE_LEARNING_CACHE_FOLDER=$CACHE_DIR Environment=MACHINE_LEARNING_MODEL_REVISION=v2 Environment=HF_HOME=$CACHE_DIR/hf-cache Environment=AMD_COMGR_CACHE_DIR=$CACHE_DIR/jit/comgr +Environment=CUDA_CACHE_PATH=$CACHE_DIR/jit/cuda ExecStart=$VENV_DIR/bin/python -m immich_ml Restart=on-failure RestartSec=5 From 5157ab329f3645849faf9133032bf472ef98a131 Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 20:40:02 +0100 Subject: [PATCH 16/18] feat(immich-remote-ml): update CUDA dependencies on upgrades --- ct/immichremoteml.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ct/immichremoteml.sh b/ct/immichremoteml.sh index e872ac443e..c3ab6e82b6 100644 --- a/ct/immichremoteml.sh +++ b/ct/immichremoteml.sh @@ -50,7 +50,11 @@ function update_script() { msg_info "Updating ${APP}" CLEAN_INSTALL=1 fetch_and_deploy_gh_release "immich-remote-ml" "immich-app/immich" "tarball" "latest" "$APP_DIR" - UV_PROJECT_ENVIRONMENT="$VENV_DIR" $STD uv sync --project "$ML_SOURCE_DIR" --locked --no-dev --no-install-project --extra "${ML_EXTRA:-cpu}" --python 3.13 --link-mode copy + UV_SYNC_ARGS=(--project "$ML_SOURCE_DIR" --locked --no-dev --no-install-project --extra "${ML_EXTRA:-cpu}" --python 3.13 --link-mode copy) + if [[ "${ML_EXTRA:-cpu}" == "cuda" ]]; then + UV_SYNC_ARGS+=(--group cuda-libs) + fi + UV_PROJECT_ENVIRONMENT="$VENV_DIR" $STD uv sync "${UV_SYNC_ARGS[@]}" msg_ok "Updated ${APP}" msg_info "Starting ${APP}" From 7cd5e931ef15730939074517823ebe861a2e0701 Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 20:40:04 +0100 Subject: [PATCH 17/18] docs(immich-remote-ml): document NVIDIA CUDA support --- json/immich-remote-ml.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/json/immich-remote-ml.json b/json/immich-remote-ml.json index b609b2e311..db9d9294ea 100644 --- a/json/immich-remote-ml.json +++ b/json/immich-remote-ml.json @@ -13,7 +13,7 @@ "architectures": ["amd64"], "platforms": ["pve"], "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/immich.webp", - "description": "Standalone native Immich machine-learning service for facial recognition and smart search. Uses AMD ROCm when an AMD GPU is passed through to the LXC, with a CPU fallback.", + "description": "Standalone native Immich machine-learning service for facial recognition and smart search. Supports NVIDIA CUDA and AMD ROCm GPU passthrough, with a CPU fallback.", "install_methods": [ { "type": "default", @@ -34,7 +34,8 @@ }, "notes": [ "In Immich, set the Machine Learning URL to http://:3003. The API has no authentication; restrict TCP port 3003 to the Immich server and trusted LAN.", - "ROCm requires AMD GPU passthrough and a compatible Proxmox host driver. For unsupported gfx1030 devices, set HSA_OVERRIDE_GFX_VERSION=10.3.0 in /etc/default/immich-remote-ml.", - "ROCm libraries and model caches require substantial disk space; the default LXC disk is 50 GiB. CPU backend is selected when no AMD GPU is detected." + "NVIDIA CUDA requires /dev/nvidia* device passthrough and a compatible host driver (Immich requires NVIDIA compute capability 5.2+ and driver 545+). The installer uses the shared helper to install matching NVIDIA userspace libraries; do not install a kernel driver inside the LXC.", + "AMD ROCm requires AMD GPU passthrough and a compatible Proxmox host driver. For unsupported gfx1030 devices, set HSA_OVERRIDE_GFX_VERSION=10.3.0 in /etc/default/immich-remote-ml.", + "CUDA and ROCm libraries plus model caches require substantial disk space; the default LXC disk is 50 GiB. CPU backend is selected when no supported GPU is detected." ] } \ No newline at end of file From ae20c571d55d2d18e992e7971f75560927469012 Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 20:40:16 +0100 Subject: [PATCH 18/18] docs(immich-remote-ml): clarify GPU architecture support --- ct/immichremoteml.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/immichremoteml.sh b/ct/immichremoteml.sh index c3ab6e82b6..1ececea54d 100644 --- a/ct/immichremoteml.sh +++ b/ct/immichremoteml.sh @@ -15,7 +15,7 @@ var_ram="${var_ram:-12288}" var_disk="${var_disk:-50}" var_os="${var_os:-debian}" var_version="${var_version:-13}" -var_arm64="${var_arm64:-no}" # ROCm and Immich's ROCm ONNX Runtime are amd64-only. +var_arm64="${var_arm64:-no}" # Immich CUDA runtime wheels and ROCm ONNX Runtime are amd64-only. var_unprivileged="${var_unprivileged:-1}" var_gpu="${var_gpu:-yes}"