1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 buildPythonPackage, 6 replaceVars, 7 8 # build-system 9 setuptools, 10 11 # runtime 12 ffmpeg-headless, 13 14 # dependencies 15 more-itertools, 16 numba, 17 numpy, 18 triton, 19 tiktoken, 20 torch, 21 tqdm, 22 23 # tests 24 pytestCheckHook, 25 scipy, 26 writableTmpDirAsHomeHook, 27}: 28 29buildPythonPackage rec { 30 pname = "whisper"; 31 version = "20250625"; 32 pyproject = true; 33 34 src = fetchFromGitHub { 35 owner = "openai"; 36 repo = "whisper"; 37 rev = "v${version}"; 38 hash = "sha256-Zn2HUCor1eCJBP7q0vpffqhw5SNguz8zCGoPgdt6P+c="; 39 }; 40 41 patches = [ 42 (replaceVars ./ffmpeg-path.patch { 43 ffmpeg = ffmpeg-headless; 44 }) 45 ]; 46 47 build-system = [ setuptools ]; 48 49 dependencies = [ 50 more-itertools 51 numba 52 numpy 53 tiktoken 54 torch 55 tqdm 56 ] 57 ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform triton) [ triton ]; 58 59 nativeCheckInputs = [ 60 pytestCheckHook 61 scipy 62 writableTmpDirAsHomeHook 63 ]; 64 65 disabledTests = [ 66 # requires network access to download models 67 "test_transcribe" 68 69 # requires NVIDIA drivers 70 "test_dtw_cuda_equivalence" 71 "test_median_filter_equivalence" 72 ] 73 ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [ 74 # Fatal Python error: Segmentation fault 75 "test_dtw" 76 ]; 77 78 meta = { 79 changelog = "https://github.com/openai/whisper/blob/v${version}/CHANGELOG.md"; 80 description = "General-purpose speech recognition model"; 81 mainProgram = "whisper"; 82 homepage = "https://github.com/openai/whisper"; 83 license = lib.licenses.mit; 84 maintainers = with lib.maintainers; [ MayNiklas ]; 85 }; 86}