diff --git a/whisper-cpp/.gitignore b/whisper-cpp/.gitignore new file mode 100644 index 0000000..51b4cfd --- /dev/null +++ b/whisper-cpp/.gitignore @@ -0,0 +1 @@ +local/ diff --git a/whisper-cpp/CHANGELOG.md b/whisper-cpp/CHANGELOG.md new file mode 100644 index 0000000..c6dc197 --- /dev/null +++ b/whisper-cpp/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 1.0.0 + +- Initial release diff --git a/whisper-cpp/Dockerfile b/whisper-cpp/Dockerfile new file mode 100644 index 0000000..91d6de2 --- /dev/null +++ b/whisper-cpp/Dockerfile @@ -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"] diff --git a/whisper-cpp/Makefile b/whisper-cpp/Makefile new file mode 100644 index 0000000..8e0ac03 --- /dev/null +++ b/whisper-cpp/Makefile @@ -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 diff --git a/whisper-cpp/README.md b/whisper-cpp/README.md new file mode 100644 index 0000000..b9e3a1e --- /dev/null +++ b/whisper-cpp/README.md @@ -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) diff --git a/whisper-cpp/run.sh b/whisper-cpp/run.sh new file mode 100755 index 0000000..2d6700a --- /dev/null +++ b/whisper-cpp/run.sh @@ -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' "$@"