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