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;
|
||||
in {
|
||||
config = let
|
||||
forkedPkg = import ./pkgs/wyoming-openwakeword.nix pkgs;
|
||||
forkedPkg = (import ./pkgs {inherit pkgs;}).wyoming-openwakeword;
|
||||
in {
|
||||
systemd.services = mkIf (cfg.openwakeword.enable) {
|
||||
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,
|
||||
fetchpatch,
|
||||
python3Packages,
|
||||
speexdsp-ns,
|
||||
tflite-runtime,
|
||||
...
|
||||
}:
|
||||
python3Packages.buildPythonApplication rec {
|
||||
pname = "openwakeword";
|
||||
version = "0.6.0";
|
||||
pyproject = true;
|
||||
}: let
|
||||
inherit (builtins) attrValues;
|
||||
in
|
||||
python3Packages.buildPythonApplication rec {
|
||||
pname = "openwakeword";
|
||||
version = "0.6.0";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "dscripka";
|
||||
repo = "openWakeWord";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-QsXV9REAHdP0Y0fVZuU+Gt9+gcPMB60bc3DOMDYuaDM=";
|
||||
};
|
||||
src = fetchFromGitHub {
|
||||
owner = "dscripka";
|
||||
repo = "openWakeWord";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-QsXV9REAHdP0Y0fVZuU+Gt9+gcPMB60bc3DOMDYuaDM=";
|
||||
};
|
||||
|
||||
# Patch upstream to enable use of full tensorflow dep
|
||||
pythonRemoveDeps = ["tflite-runtime"];
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
url = "https://github.com/dscripka/openWakeWord/pull/178/commits/99cd87e8898348255e864540e43bab17ce0576d6.patch";
|
||||
hash = "sha256-xveMBZTcYfT8LKiiStqYjjOdUOM/v4taQzSewo97Bfc=";
|
||||
})
|
||||
];
|
||||
nativeBuildInputs = with python3Packages; [
|
||||
setuptools
|
||||
];
|
||||
|
||||
nativeBuildInputs = with python3Packages; [
|
||||
setuptools
|
||||
];
|
||||
propagatedBuildInputs = attrValues {
|
||||
inherit
|
||||
(python3Packages)
|
||||
onnxruntime
|
||||
tqdm
|
||||
scipy
|
||||
scikit-learn
|
||||
requests
|
||||
;
|
||||
|
||||
propagatedBuildInputs =
|
||||
(with python3Packages; [
|
||||
onnxruntime
|
||||
tensorflow-bin
|
||||
tqdm
|
||||
scipy
|
||||
scikit-learn
|
||||
requests
|
||||
])
|
||||
++ [speexdsp-ns];
|
||||
}
|
||||
inherit
|
||||
speexdsp-ns
|
||||
tflite-runtime
|
||||
;
|
||||
};
|
||||
}
|
||||
|
|
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
|
||||
the upstream `openwakeword` instead of a fork: https://github.com/rhasspy/wyoming-openwakeword/pull/27
|
||||
*/
|
||||
pkgs: let
|
||||
pyPkgs = pkgs.python312Packages;
|
||||
|
||||
speexdsp-ns = pkgs.callPackage ./speexdsp-ns.nix {
|
||||
python3Packages = pyPkgs;
|
||||
};
|
||||
|
||||
openwakeword = pkgs.callPackage ./openwakeword.nix {
|
||||
inherit speexdsp-ns;
|
||||
python3Packages = pyPkgs;
|
||||
};
|
||||
{
|
||||
fetchFromGitHub,
|
||||
lib,
|
||||
openwakeword,
|
||||
python3Packages,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) attrValues;
|
||||
in
|
||||
(pkgs.wyoming-openwakeword.override {
|
||||
python3Packages = pyPkgs;
|
||||
})
|
||||
.overrideAttrs (o: {
|
||||
src = pkgs.fetchFromGitHub {
|
||||
python3Packages.buildPythonApplication {
|
||||
pname = "wyoming-openwakeword";
|
||||
version = "1.10.0-unstable";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "rhasspy";
|
||||
repo = "wyoming-openwakeword";
|
||||
rev = "synesthesiam-20240627-openwakeword";
|
||||
# rev = "synesthesiam-20240627-openwakeword";
|
||||
rev = "324d669645a778439c5392d9e287a763ead3cf4c";
|
||||
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