nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 hatchling,
9 hatch-vcs,
10
11 # dependencies
12 asteroid-filterbanks,
13 einops,
14 huggingface-hub,
15 lightning,
16 matplotlib,
17 opentelemetry-api,
18 opentelemetry-exporter-otlp,
19 opentelemetry-sdk,
20 pyannote-core,
21 pyannote-database,
22 pyannote-metrics,
23 pyannote-pipeline,
24 pyannoteai-sdk,
25 pytorch-metric-learning,
26 safetensors,
27 soundfile,
28 speechbrain,
29 tensorboardx,
30 torch,
31 torch-audiomentations,
32 torchaudio,
33 torchcodec,
34 torchmetrics,
35
36 # optional-dependencies
37 hydra-core,
38 typer,
39
40 # tests
41 papermill,
42 pytestCheckHook,
43}:
44
45buildPythonPackage rec {
46 pname = "pyannote-audio";
47 version = "4.0.3";
48 pyproject = true;
49
50 src = fetchFromGitHub {
51 owner = "pyannote";
52 repo = "pyannote-audio";
53 tag = version;
54 fetchSubmodules = true;
55 hash = "sha256-tgXYcqkmMaEgFU55TQ5ESMNrZiBQkiVLmIoR1bhCOKI=";
56 };
57
58 build-system = [
59 hatchling
60 hatch-vcs
61 ];
62
63 pythonRelaxDeps = [
64 "torchaudio"
65 ];
66 dependencies = [
67 asteroid-filterbanks
68 einops
69 huggingface-hub
70 lightning
71 matplotlib
72 opentelemetry-api
73 opentelemetry-exporter-otlp
74 opentelemetry-sdk
75 pyannote-core
76 pyannote-database
77 pyannote-metrics
78 pyannote-pipeline
79 pyannoteai-sdk
80 pytorch-metric-learning
81 safetensors
82 soundfile
83 speechbrain
84 tensorboardx
85 torch
86 torch-audiomentations
87 torchaudio
88 torchcodec
89 torchmetrics
90 ];
91
92 optional-dependencies = {
93 cli = [
94 hydra-core
95 typer
96 ];
97 };
98
99 pythonImportsCheck = [ "pyannote.audio" ];
100
101 nativeCheckInputs = [
102 papermill
103 pytestCheckHook
104 ];
105
106 preCheck = ''
107 $out/bin/pyannote-audio --help
108 '';
109
110 disabledTests = [
111 # Require internet access
112 "test_hf_download_inference"
113 "test_hf_download_model"
114 "test_import_speechbrain_encoder_classifier"
115 "test_skip_aggregation"
116 "test_unknown_specifications_error_raised_on_non_setup_model_task"
117
118 # AttributeError: module 'torchaudio' has no attribute 'info'
119 # Removed in torchaudio v2.9.0
120 # See https://github.com/pytorch/audio/issues/3902 for context
121 "test_audio_resample"
122 ];
123
124 disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
125 # Crashes the interpreter
126 # - On aarch64-darwin: Trace/BPT trap: 5
127 # - On x86_64-darwin: Fatal Python error: Illegal instruction
128 "tests/inference_test.py"
129 "tests/test_train.py"
130 ];
131
132 meta = {
133 description = "Neural building blocks for speaker diarization: speech activity detection, speaker change detection, overlapped speech detection, speaker embedding";
134 homepage = "https://github.com/pyannote/pyannote-audio";
135 changelog = "https://github.com/pyannote/pyannote-audio/blob/${src.tag}/CHANGELOG.md";
136 license = lib.licenses.mit;
137 maintainers = with lib.maintainers; [
138 GaetanLepage
139 ];
140 };
141}