From c4267aa23e14853a2ad1807229bcd04e01c473f0 Mon Sep 17 00:00:00 2001 From: Nicolas Graves Date: Tue, 2 Sep 2025 14:10:24 +0200 Subject: [PATCH] nongnu: Add python-openwakeword and variant. * nongnu/packages/machine-learning.scm: New file. (python-openwakeword, python-openwakeword-minimal): New variables. --- nongnu/packages/machine-learning.scm | 85 ++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 nongnu/packages/machine-learning.scm diff --git a/nongnu/packages/machine-learning.scm b/nongnu/packages/machine-learning.scm new file mode 100644 index 00000000..8aef14ae --- /dev/null +++ b/nongnu/packages/machine-learning.scm @@ -0,0 +1,85 @@ +;;; SPDX-License-Identifier: GPL-3.0-or-later +;;; Copyright © 2025 Nicolas Graves + +(define-module (nongnu packages machine-learning) + #:use-module (gnu packages) + #:use-module (gnu packages audio) + #:use-module (gnu packages check) + #:use-module (gnu packages machine-learning) + #:use-module (gnu packages python-build) + #:use-module (gnu packages python-science) + #:use-module (gnu packages python-web) + #:use-module (gnu packages python-xyz) + #:use-module (gnu packages terminals) + #:use-module (guix build-system pyproject) + #:use-module (guix gexp) + #:use-module (guix git-download) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module ((guix licenses) #:prefix license:)) + +(define-public python-openwakeword + (package + (name "python-openwakeword") + (version "0.6.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/dscripka/openWakeWord") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0cv85qv31kkhfcdss1ycqf0pxpqs7vjndma7cgsd678027sxbia2")))) + (build-system pyproject-build-system) + (arguments + (list + ;; XXX: Tests require unclearly-licensed model weights. + #:tests? #f)) + (propagated-inputs (list (list onnxruntime "python") + python-requests + python-scikit-learn + python-scipy + python-tqdm + (list tensorflow-lite "python"))) + (native-inputs (list + ;; XXX: Those are required if some tests are run. + ;; python-mock + ;; python-pytest + ;; python-pytest-cov + ;; python-pytest-flake8 + ;; python-pytest-mypy + python-setuptools + python-wheel)) + (home-page "https://github.com/dscripka/openWakeWord") + (synopsis "Wake word (or phrase) detection framework") + (description + "This package provides an open-source audio wake word (or phrase) +detection framework with a focus on performance and simplicity.") + (license license:asl2.0))) + +(define-public python-openwakeword-minimal + (package/inherit python-openwakeword + (name "python-openwakeword-minimal") + (arguments + (substitute-keyword-arguments (package-arguments python-openwakeword) + ((#:phases phases #~%standard-phases) + #~(modify-phases #$phases + (add-after 'unpack 'relax-requirements + (lambda _ + (substitute* "setup.py" + (("^ *'onnxruntime>=.*") + "")) + (delete-file "openwakeword/vad.py") + (substitute* "openwakeword/__init__.py" + (("^from openwakeword\\.vad import VAD.*") + "") + (("'VAD',") + "")))))))) + (propagated-inputs + (modify-inputs (package-propagated-inputs python-openwakeword) + (delete "onnxruntime:python"))) + (description + (string-append (package-description python-openwakeword) "\n\ +Note: This minimal variant doesn't provide the additional Voice Activity +Detection."))))