diff options
author | Anuj Solanki <anuj603362@gmail.com> | 2024-09-30 23:39:02 +0200 |
---|---|---|
committer | Anuj Solanki <anuj603362@gmail.com> | 2024-10-06 16:25:15 +0200 |
commit | 8949e1b030da7067da206a580c5124ca85ec9fbc (patch) | |
tree | 9eec1daea3ded33862a310aa66e83864acf8abc2 /meta-offline-voice-agent/recipes-whisper | |
parent | 1feb55631bea43bf7745921e247706303db4d6fc (diff) |
Remove OpenAI's Whisper AI and its dependencies
- Remove OpenAI's Whisper AI recipes and all its dependencies.
- Add recipes for whisper-cpp, whisper-cpp-base and whisper-cpp-tiny
model.
- Add recipe for python-mpd.
- Add voice-agent-config to /etc/default and update config path in
agl-service-voiceagent.service
Bug-AGL: SPEC-5200
Change-Id: Iaebd9c46930144b41659710202e9b737dbe9f60b
Signed-off-by: Anuj Solanki <anuj603362@gmail.com>
Diffstat (limited to 'meta-offline-voice-agent/recipes-whisper')
6 files changed, 69 insertions, 47 deletions
diff --git a/meta-offline-voice-agent/recipes-whisper/whisper-cpp-model/whisper-cpp-base.bb b/meta-offline-voice-agent/recipes-whisper/whisper-cpp-model/whisper-cpp-base.bb new file mode 100644 index 00000000..621eb780 --- /dev/null +++ b/meta-offline-voice-agent/recipes-whisper/whisper-cpp-model/whisper-cpp-base.bb @@ -0,0 +1,15 @@ +SUMMARY = "Whisper-cpp base model" +HOMEPAGE = "https://github.com/ggerganov/whisper.cpp" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${THISDIR}/../../licenses/LICENSE;md5=7a3cb84505132167069a95fa683a011c" + +SRC_URI = "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.bin" +SRC_URI[sha256sum] = "60ed5bc3dd14eea856493d334349b405782ddcaf0028d4b5df4088345fba2efe" + +do_install() { + # Install the models + install -d ${D}${datadir}/whisper-cpp/models + install -m 0644 ${WORKDIR}/ggml-base.bin ${D}${datadir}/whisper-cpp/models/base.bin +} + +FILES:${PN} += " /usr /usr/share /usr/share/whisper-cpp/* " diff --git a/meta-offline-voice-agent/recipes-whisper/whisper-cpp-model/whisper-cpp-tiny.bb b/meta-offline-voice-agent/recipes-whisper/whisper-cpp-model/whisper-cpp-tiny.bb new file mode 100644 index 00000000..7e4b70fb --- /dev/null +++ b/meta-offline-voice-agent/recipes-whisper/whisper-cpp-model/whisper-cpp-tiny.bb @@ -0,0 +1,15 @@ +SUMMARY = "Whisper-cpp base model" +HOMEPAGE = "https://github.com/ggerganov/whisper.cpp" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${THISDIR}/../../licenses/LICENSE;md5=7a3cb84505132167069a95fa683a011c" + +SRC_URI = "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.en.bin" +SRC_URI[sha256sum] = "921e4cf8686fdd993dcd081a5da5b6c365bfde1162e72b08d75ac75289920b1f" + +do_install() { + # Install the models + install -d ${D}${datadir}/whisper-cpp/models + install -m 0644 ${WORKDIR}/ggml-tiny.en.bin ${D}${datadir}/whisper-cpp/models/tiny.en.bin +} + +FILES:${PN} += " /usr /usr/share /usr/share/whisper-cpp/* " diff --git a/meta-offline-voice-agent/recipes-whisper/whisper-cpp/whisper-cpp_git.bb b/meta-offline-voice-agent/recipes-whisper/whisper-cpp/whisper-cpp_git.bb new file mode 100644 index 00000000..0e3e9a17 --- /dev/null +++ b/meta-offline-voice-agent/recipes-whisper/whisper-cpp/whisper-cpp_git.bb @@ -0,0 +1,39 @@ +DESCRIPTION = "Whisper.cpp - Port of OpenAI's Whisper model in C++ for faster and smaller inference" +HOMEPAGE = "https://github.com/ggerganov/whisper.cpp" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=1539dadbedb60aa18519febfeab70632" + +SRC_URI = "git://github.com/ggerganov/whisper.cpp.git;protocol=https;branch=master" + +SRCREV = "81c999fe0a25c4ebbfef10ed8a1a96df9cfc10fd" + +DEPENDS = "ffmpeg openblas" + +S = "${WORKDIR}/git" + +inherit cmake + +do_configure:prepend() { + sed -i 's/-march=native//g' ${S}/Makefile + sed -i 's/-mtune=native//g' ${S}/Makefile +} + + +# Specify the model you want to download +WHISPER_MODEL ?= "base.en" + +do_compile() { + export CXXFLAGS="${CXXFLAGS} -I${STAGING_INCDIR}/openblas" + export LDFLAGS="${LDFLAGS} -lopenblas" + cd ${S} + oe_runmake GGML_OPENBLAS=1 +} + +do_install() { + # Install the main binary + install -d ${D}${bindir} + install -m 0755 ${S}/main ${D}${bindir}/whisper-cpp +} + +FILES_${PN} += "${datadir}/whisper-cpp/models/* ${datadir}/* ${bindir}/* /usr/share " +RDEPENDS:${PN} += "openblas ffmpeg" diff --git a/meta-offline-voice-agent/recipes-whisper/whisper-model/openai-whisper-base.bb b/meta-offline-voice-agent/recipes-whisper/whisper-model/openai-whisper-base.bb deleted file mode 100644 index 42d75881..00000000 --- a/meta-offline-voice-agent/recipes-whisper/whisper-model/openai-whisper-base.bb +++ /dev/null @@ -1,14 +0,0 @@ -SUMMARY = "OpenAI Whisper base model" -HOMEPAGE = "https://github.com/openai/whisper" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${THISDIR}/../../licenses/LICENSE;md5=b1b8ea5cbbe899304ac6566613a3b74e" - -SRC_URI = "https://openaipublic.azureedge.net/main/whisper/models/ed3a0b6b1c0edf879ad9b11b1af5a0e6ab5db9205f891f668f8b0e6c6326e34e/base.pt" -SRC_URI[sha256sum] = "ed3a0b6b1c0edf879ad9b11b1af5a0e6ab5db9205f891f668f8b0e6c6326e34e" - -do_install(){ - install -d ${D}/usr/share/whisper - cp -R ${WORKDIR}/base.pt ${D}/usr/share/whisper/ -} - -FILES:${PN} = " /usr/share/whisper /usr/share/whisper/base.pt " diff --git a/meta-offline-voice-agent/recipes-whisper/whisper-model/openai-whisper-tiny.bb b/meta-offline-voice-agent/recipes-whisper/whisper-model/openai-whisper-tiny.bb deleted file mode 100644 index 19acc727..00000000 --- a/meta-offline-voice-agent/recipes-whisper/whisper-model/openai-whisper-tiny.bb +++ /dev/null @@ -1,15 +0,0 @@ -SUMMARY = "OpenAI Whisper tiny model" -HOMEPAGE = "https://github.com/openai/whisper" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${THISDIR}/../../licenses/LICENSE;md5=b1b8ea5cbbe899304ac6566613a3b74e" - -SRC_URI = "https://openaipublic.azureedge.net/main/whisper/models/65147644a518d12f04e32d6f3b26facc3f8dd46e5390956a9424a650c0ce22b9/tiny.pt" -SRC_URI[sha256sum] = "65147644a518d12f04e32d6f3b26facc3f8dd46e5390956a9424a650c0ce22b9" - -do_install(){ - install -d ${D}/usr/share/whisper - cp -R ${WORKDIR}/tiny.pt ${D}/usr/share/whisper/ -} - -FILES:${PN} = " /usr/share/whisper /usr/share/whisper/tiny.pt " - diff --git a/meta-offline-voice-agent/recipes-whisper/whisper/whisper_git.bb b/meta-offline-voice-agent/recipes-whisper/whisper/whisper_git.bb deleted file mode 100644 index 983999b5..00000000 --- a/meta-offline-voice-agent/recipes-whisper/whisper/whisper_git.bb +++ /dev/null @@ -1,18 +0,0 @@ -DESCRIPTION = "Whisper AI - General-purpose speech recognition model" -HOMEPAGE = "https://github.com/openai/whisper" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE;md5=b1b8ea5cbbe899304ac6566613a3b74e" - -SRC_URI = "git://github.com/openai/whisper.git;protocol=https;branch=main" -SRCREV = "ba3f3cd54b0e5b8ce1ab3de13e32122d0d5f98ab" - -S = "${WORKDIR}/git" - - -DEPENDS += "python3-wheel-native ffmpeg python3-numpy python3-pytorch python3-tqdm python3-tiktoken python3-more-itertools" - -inherit setuptools3 python3native - -RDEPENDS:${PN} += "ffmpeg python3-numba python3-regex python3-pytorch python3-tqdm python3-tiktoken" - - |