From 4da560bfbfcdc0f356963a9f68e32ae5e751b147 Mon Sep 17 00:00:00 2001 From: edurenye Date: Wed, 8 Jan 2025 19:13:33 +0100 Subject: [PATCH] chore: Update images and whisper version --- docker-compose.gpu.yml | 7 +++---- piper/GPU.Dockerfile | 16 ++++++++++++---- piper/__main__.py | 2 +- piper/process.py | 4 ++-- piper/run-gpu.sh | 2 +- whisper/Dockerfile | 2 +- 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/docker-compose.gpu.yml b/docker-compose.gpu.yml index ec1badf..1dbd43d 100644 --- a/docker-compose.gpu.yml +++ b/docker-compose.gpu.yml @@ -3,7 +3,7 @@ version: '3' x-gpu: &gpu build: args: - - BASE=nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 + - BASE=nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04 runtime: nvidia deploy: resources: @@ -23,12 +23,11 @@ services: build: dockerfile: GPU.Dockerfile args: - - BASE=nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04 - EXTRA_DEPENDENCIES=onnxruntime-gpu - RUN_SCRIPT=run-gpu.sh volumes: - - ./piper/__main__.py:/usr/local/lib/python3.8/dist-packages/wyoming_piper/__main__.py - - ./piper/process.py:/usr/local/lib/python3.8/dist-packages/wyoming_piper/process.py + - ./piper/__main__.py:/opt/venv/lib/python3.11/site-packages/wyoming_piper/__main__.py + - ./piper/process.py:/opt/venv/lib/python3.11/site-packages/wyoming_piper/process.py wyoming-whisper: extends: diff --git a/piper/GPU.Dockerfile b/piper/GPU.Dockerfile index c3b6c32..d85f812 100644 --- a/piper/GPU.Dockerfile +++ b/piper/GPU.Dockerfile @@ -2,7 +2,7 @@ ARG BASE=debian:bookworm-slim FROM $BASE ARG EXTRA_DEPENDENCIES -ARG RUN_SCRIPT='run-nongpu.sh' +ARG RUN_SCRIPT='run.sh' ARG TARGETARCH ARG TARGETVARIANT @@ -11,6 +11,10 @@ WORKDIR /usr/src ARG WYOMING_PIPER_VERSION='1.5.0' ARG BINARY_PIPER_VERSION='1.2.0' +# Create and activate virtual environment +ENV VIRTUAL_ENV=/opt/venv +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + RUN \ apt-get update \ && apt-get install -y --no-install-recommends \ @@ -18,8 +22,12 @@ RUN \ curl \ python3 \ python3-pip \ + python3-venv \ + \ + && rm -rf /var/lib/apt/lists/* \ \ - && rm -rf /var/lib/apt/lists/* + # Create virtual environment + && python3 -m venv $VIRTUAL_ENV RUN \ pip3 install --no-cache-dir -U \ @@ -27,9 +35,9 @@ RUN \ wheel \ $EXTRA_DEPENDENCIES \ \ - && wget https://github.com/rhasspy/piper-phonemize/releases/download/v1.1.0/piper_phonemize-1.1.0-cp39-cp39-manylinux_2_28_x86_64.whl \ + && wget https://github.com/rhasspy/piper-phonemize/releases/download/v1.1.0/piper_phonemize-1.1.0-cp311-cp311-manylinux_2_28_x86_64.whl \ \ - && mv piper_phonemize-1.1.0-cp39-cp39-manylinux_2_28_x86_64.whl piper_phonemize-1.1.0-py3-none-any.whl \ + && mv piper_phonemize-1.1.0-cp311-cp311-manylinux_2_28_x86_64.whl piper_phonemize-1.1.0-py3-none-any.whl \ \ && pip3 install --no-cache-dir --force-reinstall --no-deps \ "piper-tts==${BINARY_PIPER_VERSION}" \ diff --git a/piper/__main__.py b/piper/__main__.py index 548d7d0..dba2b88 100644 --- a/piper/__main__.py +++ b/piper/__main__.py @@ -67,7 +67,7 @@ async def main() -> None: help="Download latest voices.json during startup", ) parser.add_argument( - "--cuda", + "--use-cuda", action="store_true", help="Use GPU" ) diff --git a/piper/process.py b/piper/process.py index e479c25..28f4b68 100644 --- a/piper/process.py +++ b/piper/process.py @@ -148,8 +148,8 @@ async def get_process(self, voice_name: Optional[str] = None) -> PiperProcess: if self.args.noise_w: piper_args.extend(["--noise-w", str(self.args.noise_w)]) - 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 diff --git a/piper/run-gpu.sh b/piper/run-gpu.sh index cef02f0..618a5c2 100755 --- a/piper/run-gpu.sh +++ b/piper/run-gpu.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash python3 -m wyoming_piper \ --piper 'piper' \ - --cuda \ + --use-cuda \ --uri 'tcp://0.0.0.0:10200' \ --data-dir /data \ --download-dir /data "$@" diff --git a/whisper/Dockerfile b/whisper/Dockerfile index 4acbb4b..cb8393d 100644 --- a/whisper/Dockerfile +++ b/whisper/Dockerfile @@ -3,7 +3,7 @@ FROM $BASE # Install Whisper WORKDIR /usr/src -ARG WYOMING_WHISPER_VERSION='2.2.0' +ARG WYOMING_WHISPER_VERSION='2.4.0' RUN \ apt-get update \