Unverified Commit da097882 authored by Martin Weinelt's avatar Martin Weinelt Committed by GitHub
Browse files

wyoming-faster-whisper: 2.2.0 -> 2.4.0; wyoming-piper: 1.5.0 -> 1.5.2;...

wyoming-faster-whisper: 2.2.0 -> 2.4.0; wyoming-piper: 1.5.0 -> 1.5.2; python312Packages.wyoming: 1.5.4 -> 1.6.0 (#364274)
parents bd041a3f 0ec8d2ab
Loading
Loading
Loading
Loading
+76 −15
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  config,
  lib,
  pkgs,
  utils,
  ...
}:

@@ -20,6 +21,10 @@ let
    toString
    ;

  inherit (utils)
    escapeSystemdExecArgs
    ;

in

{
@@ -29,7 +34,7 @@ in
    servers = mkOption {
      default = { };
      description = ''
        Attribute set of faster-whisper instances to spawn.
        Attribute set of wyoming-faster-whisper instances to spawn.
      '';
      type = types.attrsOf (
        types.submodule (
@@ -43,9 +48,33 @@ in
                default = "tiny-int8";
                example = "Systran/faster-distil-whisper-small.en";
                description = ''
                  Name of the voice model to use.
                  Name of the voice model to use. Can also be a HuggingFace model ID or a path to
                  a custom model directory.

                  Check the [2.0.0 release notes](https://github.com/rhasspy/wyoming-faster-whisper/releases/tag/v2.0.0) for possible values.
                  Compressed models (`int8`) are slightly less accurate, but smaller and faster.

                  Available models:
                  - `tiny-int8` (compressed)
                  - `tiny`
                  - `tiny.en` (English only)
                  - `base-int8` (compressed)
                  - `base`
                  - `base.en` (English only)
                  - `small-int8` (compressed)
                  - `distil-small.en` (distilled, English only)
                  - `small`
                  - `small.en` (English only)
                  - `medium-int8` (compressed)
                  - `distil-medium.en` (distilled, English only)
                  - `medium`
                  - `medium.en` (English only)
                  - `large`
                  - `large-v1`
                  - `distil-large-v2` (distilled, English only)
                  - `large-v2`
                  - `distil-large-v3` (distilled, English only)
                  - `large-v3`
                  - `turbo` (faster than large-v3)
                '';
              };

@@ -171,6 +200,7 @@ in
                  "uz"
                  "vi"
                  "yi"
                  "yue"
                  "yo"
                  "zh"
                ];
@@ -180,12 +210,26 @@ in
                '';
              };

              initialPrompt = mkOption {
                type = nullOr str;
                default = null;
                example = ''
                  The following conversation takes place in the universe of Wizard of Oz. Key terms include 'Yellow Brick Road' (the path to follow), 'Emerald City' (the ultimate goal), and 'Ruby Slippers' (the magical tools to succeed). Keep these in mind as they guide the journey.
                '';
                description = ''
                  Optional text to provide as a prompt for the first window. This can be used to provide, or
                  "prompt-engineer" a context for transcription, e.g. custom vocabularies or proper nouns
                  to make it more likely to predict those word correctly.
                '';
              };

              beamSize = mkOption {
                type = ints.unsigned;
                default = 1;
                default = 0;
                example = 5;
                description = ''
                  The number of beams to use in beam search.
                  Use `0` to automatically select a value based on the CPU.
                '';
                apply = toString;
              };
@@ -233,18 +277,35 @@ in
          serviceConfig = {
            DynamicUser = true;
            User = "wyoming-faster-whisper";
            StateDirectory = "wyoming/faster-whisper";
            StateDirectory = [
              "wyoming/faster-whisper"
              "wyoming/faster-whisper/models"
            ];
            # https://github.com/home-assistant/addons/blob/master/whisper/rootfs/etc/s6-overlay/s6-rc.d/whisper/run
            ExecStart = ''
              ${cfg.package}/bin/wyoming-faster-whisper \
                --data-dir $STATE_DIRECTORY \
                --download-dir $STATE_DIRECTORY \
                --uri ${options.uri} \
                --device ${options.device} \
                --model ${options.model} \
                --language ${options.language} \
                --beam-size ${options.beamSize} ${options.extraArgs}
            '';
            ExecStart = escapeSystemdExecArgs (
              [
                (lib.getExe cfg.package)
                "--data-dir"
                "/var/lib/wyoming/faster-whisper"
                "--download-dir"
                "/var/lib/wyoming/faster-whisper/models"
                "--uri"
                options.uri
                "--device"
                options.device
                "--model"
                options.model
                "--language"
                options.language
                "--beam-size"
                options.beamSize
              ]
              ++ lib.optionals (options.initialPrompt != null) [
                "--initial-prompt"
                options.initialPrompt
              ]
              ++ options.extraArgs
            );
            CapabilityBoundingSet = "";
            DeviceAllow =
              if
+36 −28
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  config,
  lib,
  pkgs,
  utils,
  ...
}:

@@ -9,14 +10,11 @@ let
  cfg = config.services.wyoming.openwakeword;

  inherit (lib)
    concatStringsSep
    concatMapStringsSep
    escapeShellArgs
    concatMap
    mkOption
    mkEnableOption
    mkIf
    mkPackageOption
    mkRemovedOptionModule
    types
    ;

@@ -24,20 +22,12 @@ let
    toString
    ;

  inherit (utils)
    escapeSystemdExecArgs
    ;
in

{
  imports = [
    (mkRemovedOptionModule [
      "services"
      "wyoming"
      "openwakeword"
      "models"
    ] "Configuring models has been removed, they are now dynamically discovered and loaded at runtime")
  ];

  meta.buildDocsInSandbox = false;

  options.services.wyoming.openwakeword = with types; {
    enable = mkEnableOption "Wyoming openWakeWord server";

@@ -79,10 +69,10 @@ in
    };

    threshold = mkOption {
      type = float;
      type = numbers.between 0.0 1.0;
      default = 0.5;
      description = ''
        Activation threshold (0-1), where higher means fewer activations.
        Activation threshold (0.0-1.0), where higher means fewer activations.

        See trigger level for the relationship between activations and
        wake word detections.
@@ -91,7 +81,7 @@ in
    };

    triggerLevel = mkOption {
      type = int;
      type = ints.unsigned;
      default = 1;
      description = ''
        Number of activations before a detection is registered.
@@ -107,7 +97,6 @@ in
      description = ''
        Extra arguments to pass to the server commandline.
      '';
      apply = escapeShellArgs;
    };
  };

@@ -127,15 +116,34 @@ in
        DynamicUser = true;
        User = "wyoming-openwakeword";
        # https://github.com/home-assistant/addons/blob/master/openwakeword/rootfs/etc/s6-overlay/s6-rc.d/openwakeword/run
        ExecStart = concatStringsSep " " [
          "${cfg.package}/bin/wyoming-openwakeword"
          "--uri ${cfg.uri}"
          (concatMapStringsSep " " (model: "--preload-model ${model}") cfg.preloadModels)
          (concatMapStringsSep " " (dir: "--custom-model-dir ${toString dir}") cfg.customModelsDirectories)
          "--threshold ${cfg.threshold}"
          "--trigger-level ${cfg.triggerLevel}"
          "${cfg.extraArgs}"
        ];
        ExecStart = escapeSystemdExecArgs (
          [
            (lib.getExe cfg.package)
            "--uri"
            cfg.uri
            "--threshold"
            cfg.threshold
            "--trigger-level"
            cfg.triggerLevel
          ]
          ++ concatMap (
            model:
            [
              "--preload-model"
              model
            ]
              cfg.preloadModels
          )
          ++ concatMap (
            dir:
            [
              "--custom-model-dir"
              (toString dir)
            ]
              cfg.customModelsDirectories
          )
          ++ cfg.extraArgs
        );
        CapabilityBoundingSet = "";
        DeviceAllow = "";
        DevicePolicy = "closed";
+36 −21
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  config,
  lib,
  pkgs,
  utils,
  ...
}:

@@ -9,7 +10,6 @@ let
  cfg = config.services.wyoming.piper;

  inherit (lib)
    escapeShellArgs
    mkOption
    mkEnableOption
    mkPackageOption
@@ -20,18 +20,19 @@ let
    toString
    ;

  inherit (utils)
    escapeSystemdExecArgs
    ;
in

{
  meta.buildDocsInSandbox = false;

  options.services.wyoming.piper = with types; {
    package = mkPackageOption pkgs "wyoming-piper" { };

    servers = mkOption {
      default = { };
      description = ''
        Attribute set of piper instances to spawn.
        Attribute set of wyoming-piper instances to spawn.
      '';
      type = types.attrsOf (
        types.submodule (
@@ -69,7 +70,7 @@ in
              };

              noiseScale = mkOption {
                type = float;
                type = numbers.between 0.0 1.0;
                default = 0.667;
                description = ''
                  Generator noise value.
@@ -78,7 +79,7 @@ in
              };

              noiseWidth = mkOption {
                type = float;
                type = numbers.between 0.0 1.0;
                default = 0.333;
                description = ''
                  Phoneme width noise value.
@@ -87,7 +88,7 @@ in
              };

              lengthScale = mkOption {
                type = float;
                type = numbers.between 0.0 1.0;
                default = 1.0;
                description = ''
                  Phoneme length value.
@@ -101,7 +102,6 @@ in
                description = ''
                  Extra arguments to pass to the server commandline.
                '';
                apply = escapeShellArgs;
              };
            };
          }
@@ -136,20 +136,35 @@ in
          serviceConfig = {
            DynamicUser = true;
            User = "wyoming-piper";
            StateDirectory = "wyoming/piper";
            StateDirectory = [
              "wyoming/piper"
              "wyoming/piper/models"
            ];
            # https://github.com/home-assistant/addons/blob/master/piper/rootfs/etc/s6-overlay/s6-rc.d/piper/run
            ExecStart = ''
              ${cfg.package}/bin/wyoming-piper \
                --data-dir $STATE_DIRECTORY \
                --download-dir $STATE_DIRECTORY \
                --uri ${options.uri} \
                --piper ${options.piper}/bin/piper \
                --voice ${options.voice} \
                --speaker ${options.speaker} \
                --length-scale ${options.lengthScale} \
                --noise-scale ${options.noiseScale} \
                --noise-w ${options.noiseWidth} ${options.extraArgs}
            '';
            ExecStart = escapeSystemdExecArgs (
              [
                (lib.getExe cfg.package)
                "--data-dir"
                "/var/lib/wyoming/piper"
                "--download-dir"
                "/var/lib/wyoming/piper/models"
                "--uri"
                options.uri
                "--piper"
                (lib.getExe options.piper)
                "--voice"
                options.voice
                "--speaker"
                options.speaker
                "--length-scale"
                options.lengthScale
                "--noise-scale"
                options.noiseScale
                "--noise-w"
                options.noiseWidth
              ]
              ++ options.extraArgs
            );
            CapabilityBoundingSet = "";
            DeviceAllow = "";
            DevicePolicy = "closed";
+0 −60
Original line number Diff line number Diff line
{
  lib,
  python3,
  fetchFromGitHub,
}:

python3.pkgs.buildPythonApplication rec {
  pname = "homeassistant-satellite";
  version = "2.3.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "synesthesiam";
    repo = "homeassistant-satellite";
    rev = "v${version}";
    hash = "sha256-iosutOpkpt0JJIMyALuQSDLj4jk57ITShVyPYlQgMFg=";
  };

  nativeBuildInputs = with python3.pkgs; [
    setuptools
  ];

  pythonRelaxDeps = [
    "aiohttp"
  ];

  propagatedBuildInputs = with python3.pkgs; [
    aiohttp
  ];

  optional-dependencies = {
    pulseaudio = with python3.pkgs; [
      pasimple
      pulsectl
    ];
    silerovad = with python3.pkgs; [
      numpy
      onnxruntime
    ];
    webrtc = with python3.pkgs; [
      webrtc-noise-gain
    ];
  };

  pythonImportsCheck = [
    "homeassistant_satellite"
  ];

  # no tests
  doCheck = false;

  meta = with lib; {
    changelog = "https://github.com/synesthesiam/homeassistant-satellite/blob/v${version}/CHANGELOG.md";
    description = "Streaming audio satellite for Home Assistant";
    homepage = "https://github.com/synesthesiam/homeassistant-satellite";
    license = licenses.mit;
    maintainers = with maintainers; [ hexa ];
    mainProgram = "homeassistant-satellite";
  };
}
+4 −4
Original line number Diff line number Diff line
@@ -6,17 +6,17 @@

python3Packages.buildPythonApplication rec {
  pname = "wyoming-faster-whisper";
  version = "2.2.0";
  version = "2.4.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "rhasspy";
    repo = "wyoming-faster-whisper";
    rev = "refs/tags/v${version}";
    hash = "sha256-G46ycjpRu4MD00FiBM1H0DrPpXaaPlZ8yeoyZ7WYD48=";
    hash = "sha256-Ai28i+2/oWI2Y61x7U5an5MBHfuBaGy6qZZwZydS308=";
  };

  nativeBuildInputs = with python3Packages; [
  build-system = with python3Packages; [
    setuptools
  ];

@@ -25,7 +25,7 @@ python3Packages.buildPythonApplication rec {
    "wyoming"
  ];

  propagatedBuildInputs = with python3Packages; [
  dependencies = with python3Packages; [
    faster-whisper
    wyoming
  ];
Loading