浏览代码

feat(server) Enable ML support for ARM CPUs (#1880)

* Install nightly release of pytorch to enable ML support for arm CPUs

* Remove linux/arm/v7 from ML docker builds

* Add --no-cache-dir to torch installation command in ML image build

* Use PIP_NO_CACHE_DIR option in ML build to further decrease image size
Olly Welch 2 年之前
父节点
当前提交
ab90b01122
共有 2 个文件被更改,包括 6 次插入5 次删除
  1. 1 1
      .github/workflows/docker.yml
  2. 5 4
      machine-learning/Dockerfile

+ 1 - 1
.github/workflows/docker.yml

@@ -29,7 +29,7 @@ jobs:
             platforms: "linux/arm/v7,linux/amd64,linux/arm64"
           - context: "machine-learning"
             image: "immich-machine-learning"
-            platforms: "linux/amd64"
+            platforms: "linux/amd64,linux/arm64"
           - context: "nginx"
             image: "immich-proxy"
             platforms: "linux/arm/v7,linux/amd64,linux/arm64"

+ 5 - 4
machine-learning/Dockerfile

@@ -1,15 +1,16 @@
 FROM python:3.10
 
-ENV TRANSFORMERS_CACHE=/cache
-ENV PYTHONDONTWRITEBYTECODE 1
-ENV PYTHONUNBUFFERED 1
+ENV TRANSFORMERS_CACHE=/cache \
+    PYTHONDONTWRITEBYTECODE=1 \
+    PYTHONUNBUFFERED=1 \
+    PIP_NO_CACHE_DIR=true
 
 WORKDIR /usr/src/app
 
 RUN python -m venv /opt/venv
 ENV PATH="/opt/venv/bin:$PATH"
 
-RUN pip install --no-cache-dir torch==1.13.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
+RUN pip install --pre torch  -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
 RUN pip install transformers tqdm numpy scikit-learn scipy nltk sentencepiece flask Pillow
 RUN pip install --no-deps sentence-transformers