8 cfg = config.services.wyoming.faster-whisper;
25 options.services.wyoming.faster-whisper = with types; {
26 package = mkPackageOption pkgs "wyoming-faster-whisper" { };
31 Attribute set of faster-whisper instances to spawn.
33 type = types.attrsOf (types.submodule (
36 enable = mkEnableOption "Wyoming faster-whisper server";
40 default = "tiny-int8";
41 example = "Systran/faster-distil-whisper-small.en";
43 Name of the voice model to use.
45 Check the [2.0.0 release notes](https://github.com/rhasspy/wyoming-faster-whisper/releases/tag/v2.0.0) for possible values.
50 type = strMatching "^(tcp|unix)://.*$";
51 example = "tcp://0.0.0.0:10300";
53 URI to bind the wyoming server to.
58 # https://opennmt.net/CTranslate2/python/ctranslate2.models.Whisper.html#
66 Determines the platform faster-whisper is run on. CPU works everywhere, CUDA requires a compatible NVIDIA GPU.
72 # https://github.com/home-assistant/addons/blob/master/whisper/config.yaml#L20
73 "auto" "af" "am" "ar" "as" "az" "ba" "be" "bg" "bn" "bo" "br" "bs" "ca" "cs" "cy" "da" "de" "el" "en" "es" "et" "eu" "fa" "fi" "fo" "fr" "gl" "gu" "ha" "haw" "he" "hi" "hr" "ht" "hu" "hy" "id" "is" "it" "ja" "jw" "ka" "kk" "km" "kn" "ko" "la" "lb" "ln" "lo" "lt" "lv" "mg" "mi" "mk" "ml" "mn" "mr" "ms" "mt" "my" "ne" "nl" "nn" "no" "oc" "pa" "pl" "ps" "pt" "ro" "ru" "sa" "sd" "si" "sk" "sl" "sn" "so" "sq" "sr" "su" "sv" "sw" "ta" "te" "tg" "th" "tk" "tl" "tr" "tt" "uk" "ur" "uz" "vi" "yi" "yo" "zh"
77 The language used to to parse words and sentences.
86 The number of beams to use in beam search.
91 extraArgs = mkOption {
95 Extra arguments to pass to the server commandline.
97 apply = escapeShellArgs;
111 in mkIf (cfg.servers != {}) {
112 systemd.services = mapAttrs' (server: options:
113 nameValuePair "wyoming-faster-whisper-${server}" {
114 inherit (options) enable;
115 description = "Wyoming faster-whisper server instance ${server}";
117 "network-online.target"
120 "network-online.target"
125 # https://github.com/rhasspy/wyoming-faster-whisper/issues/27
126 environment."HF_HUB_CACHE" = "/tmp";
129 User = "wyoming-faster-whisper";
130 StateDirectory = "wyoming/faster-whisper";
131 # https://github.com/home-assistant/addons/blob/master/whisper/rootfs/etc/s6-overlay/s6-rc.d/whisper/run
133 ${cfg.package}/bin/wyoming-faster-whisper \
134 --data-dir $STATE_DIRECTORY \
135 --download-dir $STATE_DIRECTORY \
136 --uri ${options.uri} \
137 --device ${options.device} \
138 --model ${options.model} \
139 --language ${options.language} \
140 --beam-size ${options.beamSize} ${options.extraArgs}
142 CapabilityBoundingSet = "";
143 DeviceAllow = if builtins.elem options.device [ "cuda" "auto" ] then [
144 # https://docs.nvidia.com/dgx/pdf/dgx-os-5-user-guide.pdf
146 "char-nvidia-frontend"
150 DevicePolicy = "closed";
151 LockPersonality = true;
152 MemoryDenyWriteExecute = true;
155 ProtectHostname = true;
156 ProtectKernelLogs = true;
157 ProtectKernelModules = true;
158 ProtectKernelTunables = true;
159 ProtectControlGroups = true;
160 ProtectProc = "invisible";
162 RestrictAddressFamilies = [
167 RestrictNamespaces = true;
168 RestrictRealtime = true;
169 SystemCallArchitectures = "native";