2023-04-12 12:48:02 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, pkg-config
|
|
|
|
, ninja
|
|
|
|
, pybind11
|
|
|
|
, torch
|
2023-10-19 13:55:26 +00:00
|
|
|
, cudaSupport ? torch.cudaSupport
|
2023-04-12 12:48:02 +00:00
|
|
|
, cudaPackages
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "torchaudio";
|
2023-05-24 13:37:59 +00:00
|
|
|
version = "2.0.2";
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pytorch";
|
|
|
|
repo = "audio";
|
|
|
|
rev = "v${version}";
|
2023-05-24 13:37:59 +00:00
|
|
|
hash = "sha256-9lB4gLXq0nXHT1+DNOlbJQqNndt2I6kVoNwhMO/2qlE=";
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace 'print(" --- Initializing submodules")' "return" \
|
|
|
|
--replace "_fetch_archives(_parse_sources())" "pass"
|
|
|
|
'';
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
env = {
|
|
|
|
TORCH_CUDA_ARCH_LIST = "${lib.concatStringsSep ";" torch.cudaCapabilities}";
|
|
|
|
};
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
ninja
|
|
|
|
] ++ lib.optionals cudaSupport [
|
2023-10-19 13:55:26 +00:00
|
|
|
cudaPackages.cuda_nvcc
|
2023-04-12 12:48:02 +00:00
|
|
|
];
|
|
|
|
buildInputs = [
|
|
|
|
pybind11
|
|
|
|
] ++ lib.optionals cudaSupport [
|
2023-10-19 13:55:26 +00:00
|
|
|
cudaPackages.libcurand.dev
|
|
|
|
cudaPackages.libcurand.lib
|
|
|
|
cudaPackages.cuda_cudart # cuda_runtime.h and libraries
|
|
|
|
cudaPackages.cuda_cccl.dev # <thrust/*>
|
|
|
|
cudaPackages.cuda_nvtx.dev
|
|
|
|
cudaPackages.cuda_nvtx.lib # -llibNVToolsExt
|
|
|
|
cudaPackages.libcublas.dev
|
|
|
|
cudaPackages.libcublas.lib
|
|
|
|
cudaPackages.libcufft.dev
|
|
|
|
cudaPackages.libcufft.lib
|
2023-04-12 12:48:02 +00:00
|
|
|
];
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
torch
|
|
|
|
];
|
|
|
|
|
|
|
|
BUILD_SOX=0;
|
|
|
|
BUILD_KALDI=0;
|
|
|
|
BUILD_RNNT=0;
|
|
|
|
BUILD_CTC_DECODER=0;
|
|
|
|
|
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
|
|
|
doCheck = false; # requires sox backend
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "PyTorch audio library";
|
|
|
|
homepage = "https://pytorch.org/";
|
|
|
|
changelog = "https://github.com/pytorch/audio/releases/tag/v${version}";
|
|
|
|
license = licenses.bsd2;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ junjihashimoto ];
|
|
|
|
};
|
|
|
|
}
|