Skip to content

Commit

Permalink
Add whisper.cpp add-on
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Feb 26, 2024
1 parent 110d04c commit 3e6418b
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions whisper-cpp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
local/
5 changes: 5 additions & 0 deletions whisper-cpp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 1.0.0

- Initial release
38 changes: 38 additions & 0 deletions whisper-cpp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM debian:bookworm-slim
ARG TARGETARCH
ARG TARGETVARIANT

# Install wyoming-whisper-cpp
WORKDIR /usr/src
ENV WYOMING_WHISPER_CPP_VERSION=1.0.0
ENV PIP_BREAK_SYSTEM_PACKAGES=1

RUN \
apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
python3 \
python3-pip \
build-essential \
&& curl -L -s \
"https://github.com/rhasspy/wyoming-whisper-cpp/archive/refs/tags/v${WYOMING_WHISPER_CPP_VERSION}.tar.gz" \
| tar -zxvf - -C /tmp \
&& mv "/tmp/wyoming-whisper-cpp-${WYOMING_WHISPER_CPP_VERSION}" '/usr/share/wyoming-whisper-cpp' \
&& make -C "/usr/share/wyoming-whisper-cpp/whisper.cpp" main \
&& pip3 install --no-cache-dir -U \
setuptools \
wheel \
&& pip3 install --no-cache-dir \
--extra-index-url https://www.piwheels.org/simple \
-f . \
"/usr/share/wyoming-whisper-cpp" \
&& apt-get purge -y --auto-remove \
build-essential \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /
COPY run.sh ./

EXPOSE 10300

ENTRYPOINT ["bash", "/run.sh"]
20 changes: 20 additions & 0 deletions whisper-cpp/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.PHONY: local run update

VERSION := 1.0.0
TAG := rhasspy/wyoming-whisper-cpp
PLATFORMS := linux/amd64,linux/arm64,linux/arm/v7
HOST := 0.0.0.0
PORT := 10300
DATA_DIR := $(PWD)/local

all:
docker buildx build . --platform "$(PLATFORMS)" --tag "$(TAG):$(VERSION)" --push

update:
docker buildx build . --platform "$(PLATFORMS)" --tag "$(TAG):latest" --push

local:
docker build . -t "$(TAG):$(VERSION)" --build-arg TARGETARCH=amd64

run:
docker run -it -p "$(PORT):$(PORT)" -v "$(DATA_DIR):$(DATA_DIR)" "$(TAG):$(VERSION)" --uri 'tcp://$(HOST):$(PORT)' --data-dir "$(DATA_DIR)" --model 'tiny.en-q5_1' --debug
5 changes: 5 additions & 0 deletions whisper-cpp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# whisper.cpp

[Wyoming protocol](https://github.com/rhasspy/wyoming) server for the [whisper.cpp](https://github.com/ggerganov/whisper.cpp) speech to text system.

[Source](https://github.com/rhasspy/wyoming-whisper-cpp)
4 changes: 4 additions & 0 deletions whisper-cpp/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
python3 -m wyoming_whisper_cpp \
--whisper-cpp-dir '/usr/share/wyoming-whisper-cpp/whisper.cpp' \
--uri 'tcp://0.0.0.0:10300' "$@"

0 comments on commit 3e6418b

Please sign in to comment.