-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Add initial GPU support #4
Open
edurenye
wants to merge
20
commits into
rhasspy:master
Choose a base branch
from
edurenye:gpu
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+703
−9
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
f7e6f25
Add initial GPU support
edurenye 5a7da1c
Add support for both GPU and NONGPU Dockerfiles
edurenye 870178b
Add docker compose and instructions
edurenye 02cc7a6
Make whisper use cuda
edurenye 256cfed
Update Dockerfiles and add Vosk
edurenye b4a0522
Create __main__.py
baudneo 99d5309
Create process.py
baudneo 05998cd
Update docker-compose.gpu.yml
baudneo 56c5a65
Remove volumes, they can be added by extended docker compose files
edurenye 868f471
Fixes from rebases
edurenye a876594
Fixes from rebases
edurenye 8e6230b
Fixes from rebases
edurenye d4c69a0
Use YAML anchores, all commented services, and add whisper-cpp
edurenye da9c280
Simplify everything using BASE image args
edurenye bf0c059
Simplify everything using BASE image args
edurenye 1796e16
Add default values and use env for runtime
edurenye fbd4020
Go back to two files for piper and updated piper gpu
edurenye 4c5764a
Add microwakeword option
edurenye 936b766
chore: Add rhasspy-speech option
edurenye 4da560b
chore: Update images and whisper version
edurenye File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
version: '3' | ||
### YAML Anchors ### | ||
x-common: &common | ||
restart: unless-stopped | ||
|
||
#### | ||
services: | ||
wyoming-piper: | ||
build: | ||
context: ./piper/ | ||
ports: | ||
- "10200:10200" | ||
command: [ "--voice", "en_US-lessac-medium" ] | ||
<<: [ *common ] | ||
|
||
wyoming-whisper: | ||
build: | ||
context: ./whisper/ | ||
ports: | ||
- "10300:10300" | ||
command: [ "--model", "tiny-int8", "--language", "en" ] | ||
<<: [ *common ] | ||
|
||
# wyoming-whispercpp: | ||
# build: | ||
# context: ./whisper-cpp/ | ||
# ports: | ||
# - "10300:10300" | ||
# command: [ "--model", "tiny-int8", "--language", "en" ] | ||
# <<: [ *common ] | ||
|
||
wyoming-openwakeword: | ||
build: | ||
context: ./openwakeword/ | ||
ports: | ||
- "10400:10400" | ||
command: [ "--preload-model", "ok_nabu" ] | ||
<<: [ *common ] | ||
|
||
# wyoming-porcupine: | ||
# build: | ||
# context: ./porcupine1/ | ||
# ports: | ||
# - "10400:10400" | ||
# <<: [ *common ] | ||
|
||
# wyoming-snowboy: | ||
# build: | ||
# context: ./snowboy/ | ||
# ports: | ||
# - "10400:10400" | ||
# <<: [ *common ] | ||
|
||
# wyoming-vosk: | ||
# build: | ||
# context: ./vosk/ | ||
# ports: | ||
# - "10400:10400" | ||
# <<: [ *common ] | ||
|
||
# wyoming-microwakeword: | ||
# build: | ||
# context: ./microwakeword/ | ||
# ports: | ||
# - "10400:10400" | ||
# <<: [ *common ] | ||
|
||
# wyoming-rhasspy-speech: | ||
# build: | ||
# context: ./rhasspy-speech/ | ||
# ports: | ||
# - "10300:10300" | ||
# <<: [ *common ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
version: '3' | ||
### YAML Anchors ### | ||
x-gpu: &gpu | ||
build: | ||
args: | ||
- BASE=nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04 | ||
runtime: nvidia | ||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- driver: nvidia | ||
count: all | ||
capabilities: ["compute", "utility", "graphics"] | ||
|
||
#### | ||
services: | ||
wyoming-piper: | ||
extends: | ||
file: docker-compose.base.yml | ||
service: wyoming-piper | ||
<<: [ *gpu ] | ||
build: | ||
dockerfile: GPU.Dockerfile | ||
args: | ||
- EXTRA_DEPENDENCIES=onnxruntime-gpu | ||
- RUN_SCRIPT=run-gpu.sh | ||
volumes: | ||
- ./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: | ||
file: docker-compose.base.yml | ||
service: wyoming-whisper | ||
<<: [ *gpu ] | ||
command: [ "--model", "tiny-int8", "--language", "en", "--device", "cuda" ] | ||
|
||
# wyoming-whispercpp: | ||
# extends: | ||
# file: docker-compose.base.yml | ||
# service: wyoming-whispercpp | ||
# <<: [ *gpu ] | ||
# command: [ "--model", "tiny-int8", "--language", "en", "--device", "cuda" ] | ||
|
||
wyoming-openwakeword: | ||
extends: | ||
file: docker-compose.base.yml | ||
service: wyoming-openwakeword | ||
<<: [ *gpu ] | ||
|
||
# wyoming-porcupine: | ||
# extends: | ||
# file: docker-compose.base.yml | ||
# service: wyoming-porcupine | ||
# <<: [ *gpu ] | ||
|
||
# wyoming-snowboy: | ||
# extends: | ||
# file: docker-compose.base.yml | ||
# service: wyoming-snowboy | ||
# <<: [ *gpu ] | ||
|
||
# wyoming-vosk: | ||
# extends: | ||
# file: docker-compose.base.yml | ||
# service: wyoming-vosk | ||
# <<: [ *gpu ] | ||
|
||
# wyoming-microwakeword: | ||
# extends: | ||
# file: docker-compose.base.yml | ||
# service: wyoming-microwakeword | ||
# <<: [ *gpu ] | ||
|
||
# wyoming-rhasspy-speech: | ||
# extends: | ||
# file: docker-compose.base.yml | ||
# service: wyoming-rhasspy-speech | ||
# <<: [ *gpu ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
FROM debian:bookworm-slim | ||
ARG BASE=debian:bookworm-slim | ||
FROM $BASE | ||
|
||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
FROM debian:bookworm-slim | ||
ARG BASE=debian:bookworm-slim | ||
FROM $BASE | ||
|
||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
ARG BASE=debian:bookworm-slim | ||
FROM $BASE | ||
|
||
ARG EXTRA_DEPENDENCIES | ||
ARG RUN_SCRIPT='run.sh' | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
# Install Piper | ||
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 \ | ||
wget \ | ||
curl \ | ||
python3 \ | ||
python3-pip \ | ||
python3-venv \ | ||
\ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
\ | ||
# Create virtual environment | ||
&& python3 -m venv $VIRTUAL_ENV | ||
|
||
RUN \ | ||
pip3 install --no-cache-dir -U \ | ||
setuptools \ | ||
wheel \ | ||
$EXTRA_DEPENDENCIES \ | ||
\ | ||
&& 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-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}" \ | ||
\ | ||
&& pip3 install --no-cache-dir --force-reinstall --no-deps \ | ||
piper_phonemize-1.1.0-py3-none-any.whl \ | ||
\ | ||
&& pip3 install --no-cache-dir \ | ||
"wyoming-piper @ https://github.com/rhasspy/wyoming-piper/archive/refs/tags/v${WYOMING_PIPER_VERSION}.tar.gz" \ | ||
\ | ||
&& rm -r piper_phonemize-1.1.0-py3-none-any.whl | ||
|
||
WORKDIR / | ||
COPY $RUN_SCRIPT ./ | ||
ENV RUN_SCRIPT_ENV="/${RUN_SCRIPT}" | ||
|
||
EXPOSE 10200 | ||
|
||
ENTRYPOINT ["bash", "-c", "exec $RUN_SCRIPT_ENV \"${@}\"", "--"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we reference documentation on how to setup docker for gpu? (I can of course add it in a seperate pr)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good idea!