From 84268f3c4742c9e29dad7bd8693fa03d72a8e7a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Fri, 15 Nov 2024 22:41:26 +0100 Subject: [PATCH] Add whisperx --- hm/default.nix | 2 +- hm/{extra.nix => extra/default.nix} | 1 + hm/extra/whisperx.nix | 37 +++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) rename hm/{extra.nix => extra/default.nix} (95%) create mode 100644 hm/extra/whisperx.nix diff --git a/hm/default.nix b/hm/default.nix index 63e76a4..22917db 100644 --- a/hm/default.nix +++ b/hm/default.nix @@ -8,7 +8,7 @@ ./common.nix ./desktop ./dev - ./extra.nix + ./extra ./gaming ./git ./gpg diff --git a/hm/extra.nix b/hm/extra/default.nix similarity index 95% rename from hm/extra.nix rename to hm/extra/default.nix index 19e82b3..10580d7 100644 --- a/hm/extra.nix +++ b/hm/extra/default.nix @@ -21,6 +21,7 @@ # Communication signal-desktop + (pkgs.callPackage ./whisperx.nix {}) # Transcribe voice messages # downloading # transmission TODO Collision if both transmissions are active? diff --git a/hm/extra/whisperx.nix b/hm/extra/whisperx.nix new file mode 100644 index 0000000..f9f3f69 --- /dev/null +++ b/hm/extra/whisperx.nix @@ -0,0 +1,37 @@ +{ pkgs ? import { } }: +pkgs.python3Packages.buildPythonPackage { + pname = "whisperx"; + version = "2024-08-19"; + # pypi doesn't have the requirements.txt file, and it's required + src = pkgs.fetchFromGitHub { + owner = "m-bain"; + repo = "whisperX"; + rev = "9e3a9e0e38fcec1304e1784381059a0e2c670be5"; # git doesn't have tags + hash = "sha256-IVtn9fe/yi4+fbH57s9LoiREnMZ2nhEObp1a4R/7gHg="; + }; + pyproject = true; + dependencies = [ + pkgs.python3Packages.torch + pkgs.python3Packages.torchaudio + (pkgs.python3Packages.faster-whisper.overrideAttrs (old: { + # 1.0.2 is actually breaking APIs (requires hotwords argument) + src = pkgs.fetchFromGitHub { + owner = "SYSTRAN"; + repo = "faster-whisper"; + rev = "v1.0.0"; + hash = "sha256-0fE8X1d6CgDrrHtRudksN/tIGRtBKMvoNwkSVyFNda4="; + }; + })) + pkgs.python3Packages.transformers + pkgs.python3Packages.pyannote-audio # Not in the requirements.txt for some reason + pkgs.python3Packages.pandas + pkgs.python3Packages.nltk + ]; + build-system = [ + pkgs.python3Packages.setuptools + ]; + pythonImportsCheck = [ + "whisperx" + ]; +} +