Skip to content

Commit

Permalink
python3Packages.whisperx: init at 3.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Sparks committed Feb 18, 2025
1 parent 332682c commit 03c7f78
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkgs/development/python-modules/whisperx/changes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/whisperx/audio.py b/whisperx/audio.py
index 42f97b8..672b7d0 100644
--- a/whisperx/audio.py
+++ b/whisperx/audio.py
@@ -42,7 +42,7 @@ def load_audio(file: str, sr: int = SAMPLE_RATE) -> np.ndarray:
# Launches a subprocess to decode audio while down-mixing and resampling as necessary.
# Requires the ffmpeg CLI to be installed.
cmd = [
- "ffmpeg",
+ "@ffmpeg@/bin/ffmpeg",
"-nostdin",
"-threads",
"0",
64 changes: 64 additions & 0 deletions pkgs/development/python-modules/whisperx/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,

setuptools,
replaceVars,

ctranslate2,
faster-whisper,
ffmpeg,
nltk,
pandas,
pyannote-audio,
torch,
torchaudio,
transformers,
}:
let
pname = "whisperX";
version = "3.3.1";
in
buildPythonPackage {
inherit pname version;
pyproject = true;

src = fetchFromGitHub {
owner = "m-bain";
repo = pname;
tag = "v${version}";
hash = "sha256-Wb9jKTs0rTdgjvcnKl1P8Uh6b5jzlkKgQBcJYA+7+W4=";
};

build-system = [ setuptools ];

dependencies = [
ctranslate2
faster-whisper
nltk
pandas
pyannote-audio
torch
torchaudio
transformers
];

pythonRelaxDeps = [ "ctranslate2" "faster-whisper" ];

pythonImportsCheck = [ "whisperx" ];

makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ ffmpeg ] }" ];

# No tests LOL
doCheck = false;

meta = {
mainProgram = "whisperx";
description = "Automatic Speech Recognition with Word-level Timestamps (& Diarization) ";

platforms = lib.platforms.all;
license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [ bengsparks ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18324,6 +18324,8 @@ self: super: with self; {

whispers = callPackage ../development/python-modules/whispers { };

whisperx = callPackage ../development/python-modules/whisperx { };

whitenoise = callPackage ../development/python-modules/whitenoise { };

whodap = callPackage ../development/python-modules/whodap { };
Expand Down

0 comments on commit 03c7f78

Please sign in to comment.