nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 julius,
11 librosa,
12 torch,
13 torch-pitch-shift,
14 torchaudio,
15
16 # tests
17 pytest-cov-stub,
18 pytestCheckHook,
19}:
20
21buildPythonPackage rec {
22 pname = "torch-audiomentations";
23 version = "0.12.0";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "asteroid-team";
28 repo = "torch-audiomentations";
29 tag = "v${version}";
30 hash = "sha256-5ccVO1ECiIn0q7m8ZLHxqD2fhaXeMDKUEswa49dRTsY=";
31 };
32
33 pythonRelaxDeps = [ "torchaudio" ];
34
35 build-system = [ setuptools ];
36
37 dependencies = [
38 julius
39 librosa
40 torch
41 torch-pitch-shift
42 torchaudio
43 ];
44
45 nativeCheckInputs = [
46 pytest-cov-stub
47 pytestCheckHook
48 ];
49
50 pythonImportsCheck = [ "torch_audiomentations" ];
51
52 disabledTestPaths = [
53 # librosa issues
54 "tests/test_mix.py"
55 "tests/test_convolution.py"
56 "tests/test_impulse_response.py"
57 "tests/test_background_noise.py"
58 ];
59
60 disabledTests = [
61 # AttributeError: module 'torchaudio' has no attribute 'info'
62 # Removed in torchaudio v2.9.0
63 # See https://github.com/pytorch/audio/issues/3902 for context
64 # Reported to torch-audiomentations: https://github.com/iver56/torch-audiomentations/issues/184
65 "test_background_noise_no_guarantee_with_empty_tensor"
66 "test_colored_noise_guaranteed_with_batched_tensor"
67 "test_colored_noise_guaranteed_with_single_tensor"
68 "test_colored_noise_guaranteed_with_zero_length_samples"
69 "test_colored_noise_no_guarantee_with_single_tensor"
70 "test_same_min_max_f_decay"
71 "test_transform_is_differentiable"
72 ];
73
74 meta = {
75 description = "Fast audio data augmentation in PyTorch";
76 homepage = "https://github.com/asteroid-team/torch-audiomentations";
77 changelog = "https://github.com/asteroid-team/torch-audiomentations/releases/tag/v${version}";
78 license = lib.licenses.mit;
79 maintainers = with lib.maintainers; [ matthewcroughan ];
80 };
81}