Skip to content

Commit

Permalink
Patch cuda support into wyoming wrapper, ref rhasspy/wyoming-piper#5
Browse files Browse the repository at this point in the history
  • Loading branch information
thespad committed Nov 26, 2024
1 parent 220a224 commit 5ce7d5c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ENV DEBIAN_FRONTEND="noninteractive" \
RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
patch \
python3-venv && \
if [ -z ${PIPER_VERSION+x} ]; then \
PIPER_VERSION=$(curl -sL https://pypi.python.org/pypi/wyoming-piper/json |jq -r '. | .info.version'); \
Expand Down
3 changes: 3 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/init-piper-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

mkdir -p /run/piper-temp

patch /lsiopy/lib/python3.12/wyoming_piper/process.py < /patch/process.patch
patch /lsiopy/lib/python3.12/wyoming_piper/__main__.py < /patch/__main__.patch

# permissions
lsiown -R abc:abc \
/config \
Expand Down
14 changes: 14 additions & 0 deletions root/patch/__main__.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- __main__-old.py 2024-11-26 16:26:59.644200503 +0000
+++ __main__.py 2024-11-26 16:19:53.459497442 +0000
@@ -65,6 +65,11 @@
action="store_true",
help="Download latest voices.json during startup",
)
+ parser.add_argument(
+ "--cuda",
+ action="store_true",
+ help="Use GPU"
+ )
#
parser.add_argument("--debug", action="store_true", help="Log DEBUG messages")
args = parser.parse_args()
12 changes: 12 additions & 0 deletions root/patch/process.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- process-old.py 2024-11-26 16:20:27.856796223 +0000
+++ process.py 2024-11-26 16:19:40.522385074 +0000
@@ -148,6 +148,9 @@
if self.args.noise_w:
piper_args.extend(["--noise-w", str(self.args.noise_w)])

+ if self.args.cuda:
+ piper_args.extend(["--cuda"])
+
_LOGGER.debug(
"Starting piper process: %s args=%s", self.args.piper, piper_args
)

0 comments on commit 5ce7d5c

Please sign in to comment.