1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, cmake
5, pkg-config
6, ninja
7, pybind11
8, torch
9, cudaSupport ? false
10, cudaPackages
11}:
12
13buildPythonPackage rec {
14 pname = "torchaudio";
15 version = "2.0.2";
16
17 src = fetchFromGitHub {
18 owner = "pytorch";
19 repo = "audio";
20 rev = "v${version}";
21 hash = "sha256-9lB4gLXq0nXHT1+DNOlbJQqNndt2I6kVoNwhMO/2qlE=";
22 };
23
24 postPatch = ''
25 substituteInPlace setup.py \
26 --replace 'print(" --- Initializing submodules")' "return" \
27 --replace "_fetch_archives(_parse_sources())" "pass"
28 '';
29
30 nativeBuildInputs = [
31 cmake
32 pkg-config
33 ninja
34 ] ++ lib.optionals cudaSupport [
35 cudaPackages.cudatoolkit
36 ];
37 buildInputs = [
38 pybind11
39 ] ++ lib.optionals cudaSupport [
40 cudaPackages.cudnn
41 ];
42 propagatedBuildInputs = [
43 torch
44 ];
45
46 BUILD_SOX=0;
47 BUILD_KALDI=0;
48 BUILD_RNNT=0;
49 BUILD_CTC_DECODER=0;
50
51 dontUseCmakeConfigure = true;
52
53 doCheck = false; # requires sox backend
54
55 meta = with lib; {
56 description = "PyTorch audio library";
57 homepage = "https://pytorch.org/";
58 changelog = "https://github.com/pytorch/audio/releases/tag/v${version}";
59 license = licenses.bsd2;
60 platforms = platforms.unix;
61 maintainers = with maintainers; [ junjihashimoto ];
62 };
63}