Skip to content

Commit

Permalink
Add docker compose and instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
edurenye committed Oct 20, 2023
1 parent c330e29 commit fe4ddc4
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 2 deletions.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,65 @@ docker run -it -p 10300:10300 -v /path/to/local/data:/data rhasspy/wyoming-whisp
docker run -it -p 10200:10200 -v /path/to/local/data:/data rhasspy/wyoming-piper --voice en_US-lessac-medium
```


## Run openWakeWord

``` sh
docker run -it -p 10400:10400 rhasspy/wyoming-openwakeword --preload-model 'ok_nabu'
```


## Run snowboy

``` sh
docker run -it -p 10400:10400 rhasspy/wyoming-snowboy
```


## To run in standalone server

### Run without GPU

Build openwakeword, piper and whisper without GPU with:

``` sh
docker compose -f docker-compose.base.yml build --no-cache
```

Run it with:

``` sh
docker compose -f docker-compose.base.yml up -d
```

Take it down with:

``` sh
docker compose down
```

### Run with GPU

Build openwakeword, piper and whisper with GPU with:

``` sh
docker compose -f docker-compose.gpu.yml build --no-cache
```

Run it with:

``` sh
docker compose -f docker-compose.gpu.yml up -d
```

Take it down with:

``` sh
docker compose down
```

### Extend it

You can extend those files adding your own languages.
More on docker compose extend in the [official documentation](https://docs.docker.com/compose/multiple-compose-files/extends/).

35 changes: 35 additions & 0 deletions docker-compose.base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '3'
services:
wyoming-piper:
build:
context: ./piper/
dockerfile: NONGPU.Dockerfile
ports:
- "10200:10200"
volumes:
- ./piper-data:/data
command: [ "--voice", "en_US-lessac-medium" ]
restart: unless-stopped

wyoming-whisper:
build:
context: ./whisper/
dockerfile: NONGPU.Dockerfile
ports:
- "10300:10300"
volumes:
- ./whisper-data:/data
command: [ "--model", "tiny-int8", "--language", "en" ]
restart: unless-stopped

wyoming-openwakeword:
build:
context: ./openwakeword/
dockerfile: NONGPU.Dockerfile
ports:
- "10400:10400"
volumes:
- ./openwakeword-data:/data
command: [ "--preload-model", "ok_nabu" ]
restart: unless-stopped

44 changes: 44 additions & 0 deletions docker-compose.gpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: '3'
services:
wyoming-piper:
extends:
file: docker-compose.base.yml
service: wyoming-piper
build:
dockerfile: GPU.Dockerfile
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]

wyoming-whisper:
extends:
file: docker-compose.base.yml
service: wyoming-whisper
build:
dockerfile: GPU.Dockerfile
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]

wyoming-openwakeword:
extends:
file: docker-compose.base.yml
service: wyoming-openwakeword
build:
dockerfile: GPU.Dockerfile
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]

2 changes: 1 addition & 1 deletion piper/GPU.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ COPY run-gpu.sh ./

EXPOSE 10200

ENTRYPOINT ["bash", "/run.sh"]
ENTRYPOINT ["bash", "/run-gpu.sh"]
2 changes: 1 addition & 1 deletion piper/NONGPU.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ COPY run-nongpu.sh ./

EXPOSE 10200

ENTRYPOINT ["bash", "/run.sh"]
ENTRYPOINT ["bash", "/run-nongpu.sh"]
42 changes: 42 additions & 0 deletions snowboy/GPU.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
ARG TARGETARCH
ARG TARGETVARIANT

# Install wyoming-snowboy
WORKDIR /usr/src
ENV WYOMING_SNOWBOY_VERSION=1.0.0
ENV SNOWMAN_ENROLL_VERSION=1.0.0
ENV PIP_BREAK_SYSTEM_PACKAGES=1

RUN \
apt-get update \
&& apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-dev \
build-essential \
swig \
libatlas-base-dev \
curl \
&& pip3 install --no-cache-dir -U \
setuptools \
wheel \
&& pip3 install --no-cache-dir \
--extra-index-url https://www.piwheels.org/simple \
"wyoming-snowboy @ https://github.com/rhasspy/wyoming-snowboy/archive/refs/tags/v${WYOMING_SNOWBOY_VERSION}.tar.gz" \
&& curl --location --output - \
"https://github.com/rhasspy/snowman-enroll/releases/download/v${SNOWMAN_ENROLL_VERSION}/snowman_enroll-${TARGETARCH}${TARGETVARIANT}.tar.gz" | \
tar -xzf - \
&& apt-get remove --yes build-essential swig curl \
&& apt-get autoclean \
&& apt-get purge \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /
COPY src/train.py /usr/src/
COPY run.sh ./

EXPOSE 10400

ENTRYPOINT ["bash", "/run.sh"]

1 change: 1 addition & 0 deletions snowboy/Dockerfile → snowboy/NONGPU.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ COPY run.sh ./
EXPOSE 10400

ENTRYPOINT ["bash", "/run.sh"]

0 comments on commit fe4ddc4

Please sign in to comment.