1{ lib
2, fetchFromGitHub
3, buildPythonPackage
4, substituteAll
5
6# runtime
7, ffmpeg
8
9# propagates
10, numpy
11, torch
12, tqdm
13, more-itertools
14, transformers
15, ffmpeg-python
16
17# tests
18, pytestCheckHook
19}:
20
21buildPythonPackage rec {
22 pname = "whisper";
23 version = "unstable-2022-09-30";
24 format = "setuptools";
25
26 src = fetchFromGitHub {
27 owner = "openai";
28 repo = pname;
29 rev = "60132ade70e00b843d93542fcb37b58c0d8bf9e7";
30 hash = "sha256-4mhlCvewA0bVo5bq2sbSEKHq99TQ6jUauiCUkdRSdas=";
31 };
32
33 patches = [
34 (substituteAll {
35 src = ./ffmpeg-path.patch;
36 inherit ffmpeg;
37 })
38 ];
39
40 propagatedBuildInputs = [
41 numpy
42 torch
43 tqdm
44 more-itertools
45 transformers
46 ffmpeg-python
47 ];
48
49 preCheck = ''
50 export HOME=$TMPDIR
51 '';
52
53 checkInputs = [
54 pytestCheckHook
55 ];
56
57 disabledTests = [
58 # requires network access to download models
59 "test_transcribe"
60 ];
61
62 meta = with lib; {
63 description = "General-purpose speech recognition model";
64 homepage = "https://github.com/openai/whisper";
65 license = licenses.mit;
66 maintainers = with maintainers; [ hexa ];
67 };
68}
69