mirror of
https://github.com/slackr31337/wyoming-piper-gpu.git
synced 2026-10-19 07:51:59 +02:00
Update docker image to cuda 12.2.2 and compile piper from source
This commit is contained in:
+51
-15
@@ -1,36 +1,72 @@
|
||||
FROM nvidia/cuda:12.2.2-base-ubuntu22.04
|
||||
##########################################
|
||||
FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04 AS build
|
||||
|
||||
WORKDIR /usr/src
|
||||
|
||||
ARG TARGETARCH=linux_x86_64
|
||||
ARG WYOMING_PIPER_VERSION="1.5.0"
|
||||
ARG PIPER_RELEASE="1.2.0"
|
||||
ARG PIPER_BRANCH="2023.11.14-2"
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
COPY patches/* /tmp/
|
||||
|
||||
RUN \
|
||||
apt-get update &&\
|
||||
apt-get install -y --no-install-recommends \
|
||||
wget \
|
||||
curl \
|
||||
vim \
|
||||
git \
|
||||
build-essential \
|
||||
cmake \
|
||||
ca-certificates \
|
||||
curl \
|
||||
pkg-config
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
RUN \
|
||||
git clone -b "${PIPER_BRANCH}" https://github.com/rhasspy/piper.git /build
|
||||
|
||||
RUN cmake -Bbuild -DCMAKE_INSTALL_PREFIX=install
|
||||
RUN cmake --build build --config Release
|
||||
RUN cmake --install build
|
||||
|
||||
WORKDIR /dist
|
||||
RUN mkdir -p piper && \
|
||||
cp -dR /build/install/* ./piper/
|
||||
|
||||
RUN /dist/piper/piper --help
|
||||
|
||||
##########################################
|
||||
FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04 AS dist
|
||||
|
||||
ARG TARGETARCH=linux_x86_64
|
||||
ARG WYOMING_PIPER_VERSION="1.5.0"
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
RUN \
|
||||
apt-get update && apt-get upgrade -y &&\
|
||||
apt-get install -y --no-install-recommends \
|
||||
wget \
|
||||
curl \
|
||||
vim \
|
||||
git \
|
||||
patch \
|
||||
python3 \
|
||||
python3-dev \
|
||||
python3-venv \
|
||||
python3-pip
|
||||
python3-pip
|
||||
|
||||
RUN \
|
||||
mkdir -p /data /app &&\
|
||||
\
|
||||
mkdir -p /data /app/piper &&\
|
||||
ln -s /app/piper /usr/share/espeak-ng-data &&\
|
||||
python3 -m venv /app
|
||||
|
||||
COPY --from=build /dist/piper/* /app/piper/
|
||||
COPY requirements.txt /app/
|
||||
RUN \
|
||||
. /app/bin/activate && \
|
||||
/app/bin/python3 -m pip install --no-cache-dir --no-deps \
|
||||
"piper-tts==${PIPER_RELEASE}" \
|
||||
-r /app/requirements.txt \
|
||||
&&\
|
||||
\
|
||||
/app/bin/python3 -m pip install --no-cache-dir \
|
||||
@@ -42,12 +78,12 @@ RUN \
|
||||
wget "https://github.com/rhasspy/piper/releases/download/${PIPER_VERSION}/piper_${TARGETARCH}.tar.gz" -O -|tar -zxvf - -C /usr/share
|
||||
|
||||
# Patch to enable CUDA arguments for piper
|
||||
COPY patches/* /tmp/
|
||||
RUN \
|
||||
cd /app/lib/python3.10/site-packages/wyoming_piper/; \
|
||||
for file in /tmp/wyoming_piper*.diff;do patch -p0 --forward < $file;done; \
|
||||
cd /app/lib/python3.10/site-packages/piper/; \
|
||||
for file in /tmp/piper*.diff;do patch -p0 --forward < $file;done; \
|
||||
true
|
||||
cp /app/lib/python3.10/site-packages/onnxruntime/capi/libonnxruntime* /app/lib/ &&\
|
||||
mv /app/piper/lib*.so* /app/lib/
|
||||
|
||||
# Clean up
|
||||
RUN rm -rf /root/.cache/pip /var/lib/apt/lists/* /tmp/*
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
)
|
||||
#
|
||||
+ parser.add_argument(
|
||||
+ "--cuda",
|
||||
+ "--use-cuda",
|
||||
+ action="store_true",
|
||||
+ help="Use GPU"
|
||||
+ )
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
+ if self.args.espeak_data_dir:
|
||||
+ piper_args.extend(["--espeak_data", str(self.args.espeak_data_dir)])
|
||||
+
|
||||
+ if self.args.cuda:
|
||||
+ piper_args.extend(["--cuda"])
|
||||
+ if self.args.use_cuda:
|
||||
+ piper_args.extend(["--use-cuda"])
|
||||
+
|
||||
_LOGGER.debug(
|
||||
"Starting piper process: %s args=%s", self.args.piper, piper_args
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
piper-tts>=1.2.0
|
||||
onnxruntime==1.14.0
|
||||
onnxruntime-gpu==1.14.0
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/app/lib/python3.10/site-packages/nvidia/cudnn/lib/:/app/lib/python3.10/site-packages/nvidia/cublas/lib:/app/lib/python3.10/site-packages/nvidia/curand/lib/:/app/lib/python3.10/site-packages/nvidia/cufft/lib/:/app/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/:/app/lib/python3.10/site-packages/nvidia/cuda_nvrtc/lib/
|
||||
export LD_LIBRARY_PATH=/app/lib/:$LD_LIBRARY_PATH
|
||||
|
||||
# Run wyoming-piper server
|
||||
source /app/bin/activate
|
||||
|
||||
/app/bin/python3 -m wyoming_piper \
|
||||
--piper '/usr/share/piper/piper' \
|
||||
--piper '/app/piper/piper' \
|
||||
--uri 'tcp://0.0.0.0:10200' \
|
||||
--length-scale "${PIPER_LENGTH:-1.0}" \
|
||||
--noise-scale "${PIPER_NOISE:-0.667}" \
|
||||
@@ -16,4 +16,4 @@ source /app/bin/activate
|
||||
--max-piper-procs "${PIPER_PROCS:-1}" \
|
||||
--data-dir /data \
|
||||
--download-dir /data \
|
||||
--cuda "$@"
|
||||
--use-cuda "$@"
|
||||
|
||||
Reference in New Issue
Block a user