refactor(wyoming): move to tflite dep instead of tensorflow
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
ff6b5c753e
commit
c75cb0759d
5 changed files with 114 additions and 54 deletions
|
@ -10,7 +10,7 @@
|
||||||
cfg = config.services.wyoming;
|
cfg = config.services.wyoming;
|
||||||
in {
|
in {
|
||||||
config = let
|
config = let
|
||||||
forkedPkg = import ./pkgs/wyoming-openwakeword.nix pkgs;
|
forkedPkg = (import ./pkgs {inherit pkgs;}).wyoming-openwakeword;
|
||||||
in {
|
in {
|
||||||
systemd.services = mkIf (cfg.openwakeword.enable) {
|
systemd.services = mkIf (cfg.openwakeword.enable) {
|
||||||
wyoming-openwakeword.serviceConfig = {
|
wyoming-openwakeword.serviceConfig = {
|
||||||
|
|
19
nixosModules/wyoming-plus/pkgs/default.nix
Normal file
19
nixosModules/wyoming-plus/pkgs/default.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{pkgs, ...}: let
|
||||||
|
python3Packages = pkgs.python311Packages;
|
||||||
|
in rec {
|
||||||
|
speexdsp-ns = pkgs.callPackage ./speexdsp-ns.nix {
|
||||||
|
inherit python3Packages;
|
||||||
|
};
|
||||||
|
|
||||||
|
tflite-runtime = pkgs.callPackage ./tflite-runtime.nix {
|
||||||
|
inherit python3Packages;
|
||||||
|
};
|
||||||
|
|
||||||
|
openwakeword = pkgs.callPackage ./openwakeword.nix {
|
||||||
|
inherit python3Packages speexdsp-ns tflite-runtime;
|
||||||
|
};
|
||||||
|
|
||||||
|
wyoming-openwakeword = pkgs.callPackage ./wyoming-openwakeword.nix {
|
||||||
|
inherit openwakeword python3Packages;
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,43 +1,41 @@
|
||||||
{
|
{
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
fetchpatch,
|
|
||||||
python3Packages,
|
python3Packages,
|
||||||
speexdsp-ns,
|
speexdsp-ns,
|
||||||
|
tflite-runtime,
|
||||||
...
|
...
|
||||||
}:
|
}: let
|
||||||
python3Packages.buildPythonApplication rec {
|
inherit (builtins) attrValues;
|
||||||
pname = "openwakeword";
|
in
|
||||||
version = "0.6.0";
|
python3Packages.buildPythonApplication rec {
|
||||||
pyproject = true;
|
pname = "openwakeword";
|
||||||
|
version = "0.6.0";
|
||||||
|
pyproject = true;
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "dscripka";
|
owner = "dscripka";
|
||||||
repo = "openWakeWord";
|
repo = "openWakeWord";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
hash = "sha256-QsXV9REAHdP0Y0fVZuU+Gt9+gcPMB60bc3DOMDYuaDM=";
|
hash = "sha256-QsXV9REAHdP0Y0fVZuU+Gt9+gcPMB60bc3DOMDYuaDM=";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Patch upstream to enable use of full tensorflow dep
|
nativeBuildInputs = with python3Packages; [
|
||||||
pythonRemoveDeps = ["tflite-runtime"];
|
setuptools
|
||||||
patches = [
|
];
|
||||||
(fetchpatch {
|
|
||||||
url = "https://github.com/dscripka/openWakeWord/pull/178/commits/99cd87e8898348255e864540e43bab17ce0576d6.patch";
|
|
||||||
hash = "sha256-xveMBZTcYfT8LKiiStqYjjOdUOM/v4taQzSewo97Bfc=";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = with python3Packages; [
|
propagatedBuildInputs = attrValues {
|
||||||
setuptools
|
inherit
|
||||||
];
|
(python3Packages)
|
||||||
|
onnxruntime
|
||||||
|
tqdm
|
||||||
|
scipy
|
||||||
|
scikit-learn
|
||||||
|
requests
|
||||||
|
;
|
||||||
|
|
||||||
propagatedBuildInputs =
|
inherit
|
||||||
(with python3Packages; [
|
speexdsp-ns
|
||||||
onnxruntime
|
tflite-runtime
|
||||||
tensorflow-bin
|
;
|
||||||
tqdm
|
};
|
||||||
scipy
|
}
|
||||||
scikit-learn
|
|
||||||
requests
|
|
||||||
])
|
|
||||||
++ [speexdsp-ns];
|
|
||||||
}
|
|
||||||
|
|
15
nixosModules/wyoming-plus/pkgs/tflite-runtime.nix
Normal file
15
nixosModules/wyoming-plus/pkgs/tflite-runtime.nix
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
fetchurl,
|
||||||
|
python3Packages,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
python3Packages.buildPythonApplication {
|
||||||
|
pname = "tflite-runtime";
|
||||||
|
format = "wheel";
|
||||||
|
version = "2.14.0";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/8f/a6/02d68cb62cd221589a0ff055073251d883936237c9c990e34a1d7cecd06f/tflite_runtime-2.14.0-cp311-cp311-manylinux2014_x86_64.whl";
|
||||||
|
hash = "sha256-GVq3UuflcymmjlTdPdVDn62Ii5v/G+Dw3AQqMjepDk0=";
|
||||||
|
};
|
||||||
|
}
|
|
@ -2,28 +2,56 @@
|
||||||
This package uses a `wyoming-openwakeword` fork that makes use of
|
This package uses a `wyoming-openwakeword` fork that makes use of
|
||||||
the upstream `openwakeword` instead of a fork: https://github.com/rhasspy/wyoming-openwakeword/pull/27
|
the upstream `openwakeword` instead of a fork: https://github.com/rhasspy/wyoming-openwakeword/pull/27
|
||||||
*/
|
*/
|
||||||
pkgs: let
|
{
|
||||||
pyPkgs = pkgs.python312Packages;
|
fetchFromGitHub,
|
||||||
|
lib,
|
||||||
speexdsp-ns = pkgs.callPackage ./speexdsp-ns.nix {
|
openwakeword,
|
||||||
python3Packages = pyPkgs;
|
python3Packages,
|
||||||
};
|
...
|
||||||
|
}: let
|
||||||
openwakeword = pkgs.callPackage ./openwakeword.nix {
|
inherit (lib) attrValues;
|
||||||
inherit speexdsp-ns;
|
|
||||||
python3Packages = pyPkgs;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
(pkgs.wyoming-openwakeword.override {
|
python3Packages.buildPythonApplication {
|
||||||
python3Packages = pyPkgs;
|
pname = "wyoming-openwakeword";
|
||||||
})
|
version = "1.10.0-unstable";
|
||||||
.overrideAttrs (o: {
|
pyproject = true;
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
owner = "rhasspy";
|
owner = "rhasspy";
|
||||||
repo = "wyoming-openwakeword";
|
repo = "wyoming-openwakeword";
|
||||||
rev = "synesthesiam-20240627-openwakeword";
|
# rev = "synesthesiam-20240627-openwakeword";
|
||||||
|
rev = "324d669645a778439c5392d9e287a763ead3cf4c";
|
||||||
hash = "sha256-69oR2LHiUfx8j39nWp7XhG5xTvmOoPCLjSlH1CFvavo=";
|
hash = "sha256-69oR2LHiUfx8j39nWp7XhG5xTvmOoPCLjSlH1CFvavo=";
|
||||||
};
|
};
|
||||||
|
|
||||||
propagatedBuildInputs = [openwakeword pyPkgs.wyoming];
|
nativeBuildInputs = attrValues {
|
||||||
})
|
inherit
|
||||||
|
(python3Packages)
|
||||||
|
setuptools
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
|
pythonRelaxDeps = [
|
||||||
|
"wyoming"
|
||||||
|
];
|
||||||
|
|
||||||
|
propagatedBuildInputs = attrValues {
|
||||||
|
inherit
|
||||||
|
(python3Packages)
|
||||||
|
wyoming
|
||||||
|
;
|
||||||
|
|
||||||
|
inherit openwakeword;
|
||||||
|
};
|
||||||
|
|
||||||
|
pythonImportsCheck = [
|
||||||
|
"wyoming_openwakeword"
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Open source voice assistant toolkit for many human languages";
|
||||||
|
homepage = "https://github.com/rhasspy/wyoming-openwakeword";
|
||||||
|
license = lib.licenses.mit;
|
||||||
|
mainProgram = "wyoming-openwakeword";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue