1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4
5# dependencies
6, av
7, ctranslate2
8, huggingface-hub
9, onnxruntime
10, tokenizers
11
12# tests
13, pytestCheckHook
14}:
15
16buildPythonPackage rec {
17 pname = "faster-whisper";
18 version = "0.9.0";
19 format = "setuptools";
20
21 src = fetchFromGitHub {
22 owner = "guillaumekln";
23 repo = "faster-whisper";
24 rev = "refs/tags/v${version}";
25 hash = "sha256-kHXX5Z4r7+lFRBtTCsPy9DILwsk3T1mcBzmJnCrKTdk=";
26 };
27
28 postPatch = ''
29 substituteInPlace requirements.txt \
30 --replace "onnxruntime>=1.14,<2" "onnxruntime"
31 '';
32
33 propagatedBuildInputs = [
34 av
35 ctranslate2
36 huggingface-hub
37 onnxruntime
38 tokenizers
39 ];
40
41 pythonImportsCheck = [
42 "faster_whisper"
43 ];
44
45 # all tests require downloads
46 doCheck = false;
47
48 nativeCheckInputs = [
49 pytestCheckHook
50 ];
51
52 preCheck = ''
53 export HOME=$TMPDIR
54 '';
55
56 meta = with lib; {
57 changelog = "https://github.com/guillaumekln/faster-whisper/releases/tag/v${version}";
58 description = "Faster Whisper transcription with CTranslate2";
59 homepage = "https://github.com/guillaumekln/faster-whisper";
60 license = licenses.mit;
61 maintainers = with maintainers; [ hexa ];
62 };
63}