feat: Add USE_GPU argument to Dockerfile and docker-compose for GPU support

This commit is contained in:
JB
2025-12-21 08:31:51 -08:00
parent 938e122166
commit 899c9f5aa5
2 changed files with 8 additions and 0 deletions
+7
View File
@@ -8,6 +8,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
ARG TORCH_INDEX_URL=https://download.pytorch.org/whl/cu124 ARG TORCH_INDEX_URL=https://download.pytorch.org/whl/cu124
ARG TORCH_VERSION= ARG TORCH_VERSION=
ARG USE_GPU=true
RUN apt-get update \ RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
@@ -38,6 +39,12 @@ RUN pip install --upgrade pip \
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl \ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl \
&& pip install --no-cache-dir "mutagen>=1.47.0" && pip install --no-cache-dir "mutagen>=1.47.0"
# Install onnxruntime-gpu for CUDA acceleration (supertonic uses ONNX Runtime)
# Set USE_GPU=false to skip this for CPU-only deployments
RUN if [ "$USE_GPU" = "true" ]; then \
pip install --no-cache-dir onnxruntime-gpu; \
fi
ENV ABOGEN_HOST=0.0.0.0 \ ENV ABOGEN_HOST=0.0.0.0 \
ABOGEN_PORT=8808 ABOGEN_PORT=8808
+1
View File
@@ -16,6 +16,7 @@ services:
args: args:
TORCH_INDEX_URL: ${TORCH_INDEX_URL:-https://download.pytorch.org/whl/cu124} TORCH_INDEX_URL: ${TORCH_INDEX_URL:-https://download.pytorch.org/whl/cu124}
TORCH_VERSION: ${TORCH_VERSION:-} TORCH_VERSION: ${TORCH_VERSION:-}
USE_GPU: ${USE_GPU:-true}
image: abogen:latest image: abogen:latest
user: "${ABOGEN_UID:-1000}:${ABOGEN_GID:-1000}" user: "${ABOGEN_UID:-1000}:${ABOGEN_GID:-1000}"
ports: ports: