mirror of
https://github.com/rhasspy/rhasspy.git
synced 2022-02-12 01:59:45 +03:00
Support for Mycroft Precise
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -94,3 +94,6 @@
|
||||
[submodule "rhasspy-homeassistant-hermes"]
|
||||
path = rhasspy-homeassistant-hermes
|
||||
url = https://github.com/rhasspy/rhasspy-homeassistant-hermes
|
||||
[submodule "rhasspy-wake-precise-hermes"]
|
||||
path = rhasspy-wake-precise-hermes
|
||||
url = ./rhasspy-wake-precise-hermes/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
ARG BUILD_ARCH=amd64
|
||||
FROM ${BUILD_ARCH}/ubuntu:bionic as build
|
||||
ARG BUILD_ARCH=amd64
|
||||
ARG CPU_ARCH=x86_64
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
@@ -34,6 +35,20 @@ COPY download/snowboy-1.3.0.tar.gz /
|
||||
# Exclude snowboy from arm64
|
||||
RUN if [ "$BUILD_ARCH" != "arm64v8" ]; then ${RHASSPY_PIP} install /snowboy-1.3.0.tar.gz; fi
|
||||
|
||||
# MITLM
|
||||
ADD download/mitlm-0.4.2-${FRIENDLY_ARCH}.tar.gz /
|
||||
RUN cd /mitlm && mv bin/* ${RHASSPY_VENV}/tools/ && mv lib/* ${RHASSPY_VENV}/tools/
|
||||
|
||||
# Phonetisuarus
|
||||
ADD download/phonetisaurus-2019-${FRIENDLY_ARCH}.tar.gz /phonetisaurus/
|
||||
RUN cd /phonetisaurus && mv bin/* ${RHASSPY_VENV}/tools/ && mv lib/* ${RHASSPY_VENV}/tools/
|
||||
|
||||
# Kaldi
|
||||
ADD download/kaldi-2020-${FRIENDLY_ARCH}.tar.gz ${RHASSPY_VENV}/tools/
|
||||
|
||||
# Mycroft Precise Engine
|
||||
ADD download/precise-engine_0.3.0_${CPU_ARCH}.tar.gz ${RHASSPY_VENV}/tools/
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Runtime Image
|
||||
# -----------------------------------------------------------------------------
|
||||
@@ -42,6 +57,7 @@ ARG BUILD_ARCH=amd64
|
||||
FROM ${BUILD_ARCH}/ubuntu:bionic
|
||||
ARG BUILD_ARCH=amd64
|
||||
ARG FRIENDLY_ARCH=amd64
|
||||
ARG CPU_ARCH=x86_64
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
ENV RHASSPY_DIR=/usr/lib/rhasspy-voltron
|
||||
@@ -53,17 +69,6 @@ COPY etc/qemu-aarch64-static /usr/bin/
|
||||
# Copy Rhasspy virtual environment
|
||||
COPY --from=build ${RHASSPY_VENV} ${RHASSPY_VENV}
|
||||
|
||||
# MITLM
|
||||
ADD download/mitlm-0.4.2-${FRIENDLY_ARCH}.tar.gz /
|
||||
RUN cd /mitlm && mv bin/* /usr/bin/ && mv lib/* /usr/lib/
|
||||
|
||||
# Phonetisuarus
|
||||
ADD download/phonetisaurus-2019-${FRIENDLY_ARCH}.tar.gz /phonetisaurus/
|
||||
RUN cd /phonetisaurus && mv bin/* /usr/bin/ && mv lib/* /usr/lib/
|
||||
|
||||
# Kaldi
|
||||
ADD download/kaldi-2020-${FRIENDLY_ARCH}.tar.gz ${RHASSPY_DIR}/rhasspy-asr-kaldi/rhasspyasr_kaldi/
|
||||
|
||||
# Install Debian dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get install --no-install-recommends --yes \
|
||||
@@ -102,6 +107,7 @@ COPY rhasspy-supervisor/ ${RHASSPY_DIR}/rhasspy-supervisor/
|
||||
COPY rhasspy-tts-cli-hermes/ ${RHASSPY_DIR}/rhasspy-tts-cli-hermes/
|
||||
COPY rhasspy-wake-pocketsphinx-hermes/ ${RHASSPY_DIR}/rhasspy-wake-pocketsphinx-hermes/
|
||||
COPY rhasspy-wake-porcupine-hermes/ ${RHASSPY_DIR}/rhasspy-wake-porcupine-hermes/
|
||||
COPY rhasspy-wake-precise-hermes/ ${RHASSPY_DIR}/rhasspy-wake-precise-hermes/
|
||||
COPY rhasspy-wake-snowboy-hermes/ ${RHASSPY_DIR}/rhasspy-wake-snowboy-hermes/
|
||||
|
||||
# Web artifacts
|
||||
|
||||
@@ -100,6 +100,7 @@ COPY rhasspy-supervisor/ ${RHASSPY_DIR}/rhasspy-supervisor/
|
||||
COPY rhasspy-tts-cli-hermes/ ${RHASSPY_DIR}/rhasspy-tts-cli-hermes/
|
||||
COPY rhasspy-wake-pocketsphinx-hermes/ ${RHASSPY_DIR}/rhasspy-wake-pocketsphinx-hermes/
|
||||
COPY rhasspy-wake-porcupine-hermes/ ${RHASSPY_DIR}/rhasspy-wake-porcupine-hermes/
|
||||
COPY rhasspy-wake-precise-hermes/ ${RHASSPY_DIR}/rhasspy-wake-precise-hermes/
|
||||
COPY rhasspy-wake-snowboy-hermes/ ${RHASSPY_DIR}/rhasspy-wake-snowboy-hermes/
|
||||
|
||||
# Web artifacts
|
||||
|
||||
@@ -22,6 +22,8 @@ else
|
||||
DOCKER_TAGS = -t "$(version_tag)" -t "rhasspy/$(PACKAGE_NAME):latest"
|
||||
endif
|
||||
|
||||
all: venv
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Python
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
@@ -21,4 +21,5 @@ rhasspy-supervisor
|
||||
rhasspy-tts-cli-hermes
|
||||
rhasspy-wake-pocketsphinx-hermes
|
||||
rhasspy-wake-porcupine-hermes
|
||||
rhasspy-wake-precise-hermes
|
||||
rhasspy-wake-snowboy-hermes
|
||||
|
||||
@@ -13,4 +13,5 @@ rhasspy-supervisor
|
||||
rhasspy-tts-cli-hermes
|
||||
rhasspy-wake-pocketsphinx-hermes
|
||||
rhasspy-wake-porcupine-hermes
|
||||
rhasspy-wake-precise-hermes
|
||||
rhasspy-wake-snowboy-hermes
|
||||
|
||||
18
bin/rhasspy-wake-precise-hermes
Executable file
18
bin/rhasspy-wake-precise-hermes
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Directory of *this* script
|
||||
this_dir="$( cd "$( dirname "$0" )" && pwd )"
|
||||
src_dir="$(realpath "${this_dir}/..")"
|
||||
venv="${src_dir}/.venv"
|
||||
|
||||
if [[ ! -d "${venv}" ]]; then
|
||||
echo "Missing virtual environment at ${venv}"
|
||||
echo 'Did you run "make venv"?'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source "${venv}/bin/activate"
|
||||
|
||||
export PYTHONPATH="${src_dir}:${PYTHONPATH}"
|
||||
python3 -m rhasspywake_precise_hermes "$@"
|
||||
@@ -29,10 +29,15 @@ export PATH="${this_dir}:${PATH}"
|
||||
|
||||
if [[ -d "${venv}/tools" ]]; then
|
||||
export PATH="${venv}/tools:${PATH}"
|
||||
export LD_LIBRARY_PATH="${venv}/tools:${LD_LIBRARY_PATH}"
|
||||
|
||||
if [[ -d "${venv}/tools/kaldi" ]]; then
|
||||
export KALDI_DIR="${venv}/tools/kaldi"
|
||||
fi
|
||||
|
||||
if [[ -d "${venv}/tools/precise-engine" ]]; then
|
||||
export PRECISE_ENGINE_DIR="${venv}/tools/precise-engine"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Site packages (for PyInstaller scripts)
|
||||
|
||||
4
debian/bin/rhasspy-exec
vendored
4
debian/bin/rhasspy-exec
vendored
@@ -12,5 +12,9 @@ if [[ -d "${rhasspy_dir}/kaldi" ]]; then
|
||||
export KALDI_DIR="${rhasspy_dir}/kaldi"
|
||||
fi
|
||||
|
||||
if [[ -d "${rhasspy_dir}/precise-engine" ]]; then
|
||||
export PRECISE_ENGINE_DIR="${rhasspy_dir}/precise-engine"
|
||||
fi
|
||||
|
||||
# Run service
|
||||
"${rhasspy_dir}/rhasspy" "$@"
|
||||
|
||||
@@ -80,6 +80,7 @@ rhasspysupervisor \
|
||||
--profile "${profile_name}" \
|
||||
--system-profiles "${system_profiles}" \
|
||||
--user-profiles "${user_profiles}" \
|
||||
--docker-compose '' \
|
||||
--debug
|
||||
|
||||
# Run web server
|
||||
|
||||
@@ -6,6 +6,7 @@ Available wake word systems are:
|
||||
|
||||
* [Porcupine](wake-word.md#porcupine)
|
||||
* [Snowboy](wake-word.md#snowboy)
|
||||
* [Mycroft Precise](wake-word.md#precise)
|
||||
* [Pocketsphinx](wake-word.md#pocketsphinx)
|
||||
* [External Command](wake-word.md#command)
|
||||
|
||||
@@ -17,8 +18,8 @@ The following table summarizes the key characteristics of each wake word system:
|
||||
| ------ | ----------- | ----------------- | ----------------------- |
|
||||
| [porcupine](wake-word.md#porcupine) | excellent | yes, offline | no |
|
||||
| [snowboy](wake-word.md#snowboy) | good | yes, online | yes |
|
||||
| [pocketsphinx](wake-word.md#pocketsphinx) | poor | no | no |
|
||||
| [precise](wake-word.md#mycroft-precise) | moderate | yes, offline | no |
|
||||
| [pocketsphinx](wake-word.md#pocketsphinx) | poor | no | no |
|
||||
|
||||
## MQTT/Hermes
|
||||
|
||||
@@ -155,8 +156,6 @@ Implemented by [rhasspy-wake-pocketsphinx-hermes](https://github.com/rhasspy/rha
|
||||
|
||||
## Mycroft Precise
|
||||
|
||||
**Not supported yet in 2.5!**
|
||||
|
||||
Listens for a wake word with [Mycroft Precise](https://github.com/MycroftAI/mycroft-precise). It requires training up front, but can be done completely offline!
|
||||
|
||||
Add to your [profile](profiles.md):
|
||||
@@ -165,7 +164,7 @@ Add to your [profile](profiles.md):
|
||||
"wake": {
|
||||
"system": "precise",
|
||||
"precise": {
|
||||
"model": "model-name-in-profile.pb",
|
||||
"model": "model-name.pb",
|
||||
"sensitivity": 0.5,
|
||||
"trigger_level": 3,
|
||||
"chunk_size": 2048
|
||||
@@ -177,7 +176,13 @@ Add to your [profile](profiles.md):
|
||||
}
|
||||
```
|
||||
|
||||
Follow [the instructions from Mycroft AI](https://github.com/MycroftAI/mycroft-precise/wiki/Training-your-own-wake-word#how-to-train-your-own-wake-word) to train your own wake word model. When you're finished, place **both** the `.pb` and `.pb.params` files in your profile directory, and set `wake.precise.model` to the name of the `.pb` file.
|
||||
Follow [the instructions from Mycroft AI](https://github.com/MycroftAI/mycroft-precise/wiki/Training-your-own-wake-word#how-to-train-your-own-wake-word) to train your own wake word model. When you're finished, place **both** the `.pb` and `.pb.params` files in the `precise` directory of your profile. Then set `wake.precise.model` to the name of the `.pb` file (e.g., `my-wake-word.pb`).
|
||||
|
||||
### UDP Audio Streaming
|
||||
|
||||
By default, Rhasspy will stream microphone audio over MQTT in WAV chunks. When using Rhasspy in a [master/satellite](tutorials.md#server-with-satellites) setup, it may be desirable to only send audio to the MQTT broker after the satellite as woken up. For this case, set **both** `microphone.<MICROPHONE_SYSTEM>.udp_audio_port` and `wake.precise.udp_audio_port` to the **same** free port number on your satellite. This will cause the microphone service to stream over UDP until an [`asr/startListening`](reference.md#asr_startlistening) message is received. It will go back to UDP stream when an [`asr/stopListening`](reference.md#asr_stoplistening).
|
||||
|
||||
Implemented by [rhasspy-wake-precise-hermes](https://github.com/rhasspy/rhasspy-wake-precise-hermes)
|
||||
|
||||
## Command
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ networkx==2.4
|
||||
num2words==0.5.10
|
||||
paho-mqtt==1.5.0
|
||||
pocketsphinx==0.1.15
|
||||
precise-runner==0.3.1
|
||||
PyAudio==0.2.11
|
||||
pydash==4.7.6
|
||||
pyyaml==5.3
|
||||
|
||||
Submodule rhasspy-asr-kaldi-hermes updated: 60ee6b416d...7710d072f0
Submodule rhasspy-asr-pocketsphinx-hermes updated: b93863228d...a48186ab81
Submodule rhasspy-dialogue-hermes updated: c9edc42a10...76f7302961
Submodule rhasspy-fuzzywuzzy-hermes updated: e1227ff567...84e475712f
Submodule rhasspy-homeassistant-hermes updated: f2113d9b82...0d60c28fd0
Submodule rhasspy-microphone-cli-hermes updated: c3ba9019a8...ecb23c3c16
Submodule rhasspy-microphone-pyaudio-hermes updated: d214019d1e...e14587d9a9
Submodule rhasspy-nlu-hermes updated: b236407ab0...7f5fab6a6e
Submodule rhasspy-profile updated: aef8a2e830...8a4f9366ed
Submodule rhasspy-remote-http-hermes updated: 3d644e738a...64915e09aa
Submodule rhasspy-server-hermes updated: 936a6da8a6...9fa2928252
Submodule rhasspy-speakers-cli-hermes updated: 17795892ea...f22dc9e317
Submodule rhasspy-supervisor updated: 3b845558ff...d1ab08a0e0
Submodule rhasspy-tts-cli-hermes updated: 656a8bef84...0213412a48
Submodule rhasspy-wake-pocketsphinx-hermes updated: d07f358e12...5849a1c533
Submodule rhasspy-wake-porcupine-hermes updated: 1c4b30a983...1cd931d029
1
rhasspy-wake-precise-hermes
Submodule
1
rhasspy-wake-precise-hermes
Submodule
Submodule rhasspy-wake-precise-hermes added at bfdeef2ab1
Submodule rhasspy-wake-snowboy-hermes updated: 7043202518...77ae1e7785
@@ -33,6 +33,7 @@ fi
|
||||
|
||||
declare -A friendly_archs
|
||||
friendly_archs=(['amd64']='amd64' ['arm32v7']='armhf' ['arm64v8']='aarch64' ['arm32v6']='arm32v6')
|
||||
cpu_archs=(['amd64']='x86_64' ['arm32v7']='armv7l' ['arm64v8']='aarch64' ['arm32v6']='armv6l')
|
||||
|
||||
for docker_arch in "${docker_archs[@]}"; do
|
||||
friendly_arch="${friendly_archs[${docker_arch}]}"
|
||||
@@ -48,6 +49,7 @@ for docker_arch in "${docker_archs[@]}"; do
|
||||
docker build "${src_dir}" \
|
||||
--build-arg "BUILD_ARCH=${docker_arch}" \
|
||||
--build-arg "FRIENDLY_ARCH=${friendly_arch}" \
|
||||
--build-arg "CPU_ARCH=${cpu_arch}" \
|
||||
-f Dockerfile.source.alsa \
|
||||
-t "${docker_tag}"
|
||||
else
|
||||
@@ -55,6 +57,7 @@ for docker_arch in "${docker_archs[@]}"; do
|
||||
docker build "${src_dir}" \
|
||||
--build-arg "BUILD_ARCH=${docker_arch}" \
|
||||
--build-arg "FRIENDLY_ARCH=${friendly_arch}" \
|
||||
--build-arg "CPU_ARCH=${cpu_arch}" \
|
||||
-f Dockerfile.source.alsa.pizero \
|
||||
-t "${docker_tag}"
|
||||
fi
|
||||
|
||||
@@ -10,6 +10,7 @@ this_dir="$( cd "$( dirname "$0" )" && pwd )"
|
||||
src_dir="$(realpath "${this_dir}/..")"
|
||||
|
||||
python_name="$(basename "${src_dir}" | sed -e 's/-//' | sed -e 's/-/_/g')"
|
||||
cpu_arch="$(uname -m)"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
@@ -69,12 +70,18 @@ if [[ -s "${download}/phonetisaurus-2019-${architecture}.tar.gz" ]]; then
|
||||
"${src_dir}/scripts/install-phonetisaurus.sh" "${download}/phonetisaurus-2019-${architecture}.tar.gz" "${venv}/tools"
|
||||
fi
|
||||
|
||||
# Phonetisaurus
|
||||
# Kaldi
|
||||
if [[ -s "${download}/kaldi-2020-${architecture}.tar.gz" ]]; then
|
||||
echo 'Installing Kaldi'
|
||||
"${src_dir}/scripts/install-kaldi.sh" "${download}/kaldi-2020-${architecture}.tar.gz" "${venv}/tools"
|
||||
fi
|
||||
|
||||
# Mycroft Precise
|
||||
if [[ -s "${download}/precise-engine_0.3.0_${cpu_arch}.tar.gz" ]]; then
|
||||
echo 'Installing Mycroft Precise'
|
||||
"${src_dir}/scripts/install-precise.sh" "${download}/precise-engine_0.3.0_${cpu_arch}.tar.gz" "${venv}/tools"
|
||||
fi
|
||||
|
||||
echo 'Installing requirements'
|
||||
pip3 ${PIP_INSTALL} -r requirements.txt
|
||||
|
||||
|
||||
10
scripts/install-precise.sh
Executable file
10
scripts/install-precise.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
precise="$1"
|
||||
output="$2"
|
||||
|
||||
if [[ -z "${output}" ]]; then
|
||||
echo "Usage: install-precise.sh precise-engine.tar.gz output-dir/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tar -C "${output}" -xvf "${precise}"
|
||||
Reference in New Issue
Block a user