Unverified Commit f0b499e4 authored by Fabian Affolter's avatar Fabian Affolter Committed by GitHub
Browse files

Merge pull request #335341 from fabaff/torch-pitch-shift-fix

python312Packages.torch-pitch-shift: refactor
parents 647f8f47 af9f6622
Loading
Loading
Loading
Loading
+25 −13
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  wheel,
  asteroid-filterbanks,
  buildPythonPackage,
  einops,
  fetchFromGitHub,
  huggingface-hub,
  pytorch-lightning,
  hydra-core,
  numpy,
  omegaconf,
  pyannote-core,
  pyannote-database,
  pyannote-metrics,
  pyannote-pipeline,
  pyscaffold,
  pythonOlder,
  pytorch-lightning,
  pytorch-metric-learning,
  rich,
  semver,
  setuptools,
  soundfile,
  speechbrain,
  tensorboardx,
  torch,
  torch-audiomentations,
  torch,
  torchaudio,
  torchmetrics,
  numpy,
  pyscaffold,
  typer,
}:

buildPythonPackage rec {
@@ -32,6 +34,8 @@ buildPythonPackage rec {
  version = "3.3.0";
  pyproject = true;

  disabled = pythonOlder "3.9";

  src = fetchFromGitHub {
    owner = "pyannote";
    repo = "pyannote-audio";
@@ -40,20 +44,21 @@ buildPythonPackage rec {
    fetchSubmodules = true;
  };

  nativeBuildInputs = [
  pythonRelaxDeps = [ "torchaudio" ];

  build-system = [
    pyscaffold
    setuptools
    wheel
  ];

  postPatch = ''
    substituteInPlace setup.cfg \
      --replace "pyscaffold>=3.2a0,<3.3a0" "pyscaffold"
      --replace-fail "pyscaffold>=3.2a0,<3.3a0" "pyscaffold"
    substituteInPlace requirements.txt \
      --replace "lightning" "pytorch-lightning"
      --replace-fail "lightning" "pytorch-lightning"
  '';

  propagatedBuildInputs = [
  dependencies = [
    asteroid-filterbanks
    einops
    huggingface-hub
@@ -76,6 +81,13 @@ buildPythonPackage rec {
    pytorch-lightning
  ];

  optional-dependencies = {
    cli = [
      hydra-core
      typer
    ];
  };

  pythonImportsCheck = [ "pyannote.audio" ];

  meta = with lib; {
+27 −8
Original line number Diff line number Diff line
@@ -2,13 +2,15 @@
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  wheel,
  julius,
  librosa,
  pytest-cov-stub,
  pytestCheckHook,
  pythonOlder,
  setuptools,
  torch-pitch-shift,
  torch,
  torchaudio,
  torch-pitch-shift,
}:

buildPythonPackage rec {
@@ -16,6 +18,8 @@ buildPythonPackage rec {
  version = "0.11.1";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "asteroid-team";
    repo = "torch-audiomentations";
@@ -23,7 +27,11 @@ buildPythonPackage rec {
    hash = "sha256-0+5wc+mP4c221q6mdaqPalfumTOtdnkjnIPtLErOp9E=";
  };

  propagatedBuildInputs = [
  pythonRelaxDeps = [ "torchaudio" ];

  build-system = [ setuptools ];

  dependencies = [
    julius
    librosa
    torch
@@ -31,16 +39,27 @@ buildPythonPackage rec {
    torch-pitch-shift
  ];

  nativeBuildInputs = [
    setuptools
    wheel
  nativeCheckInputs = [
    pytest-cov-stub
    pytestCheckHook
  ];

  pythonImportsCheck = [ "torch_audiomentations" ];

  disabledTestPaths = [
    # librosa issues
    "tests/test_mix.py"
    "tests/test_convolution.py"
    "tests/test_impulse_response.py"
    "tests/test_background_noise.py"
  ];

  disabledTests = [ "test_transform_is_differentiable" ];

  meta = with lib; {
    description = "Fast audio data augmentation in PyTorch. Inspired by audiomentations. Useful for deep learning";
    description = "Fast audio data augmentation in PyTorch";
    homepage = "https://github.com/asteroid-team/torch-audiomentations";
    changelog = "https://github.com/asteroid-team/torch-audiomentations/releases/tag/v${version}";
    license = licenses.mit;
    maintainers = with maintainers; [ matthewcroughan ];
  };
+12 −7
Original line number Diff line number Diff line
@@ -3,11 +3,11 @@
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  wheel,
  packaging,
  primepy,
  torch,
  torchaudio,
  pythonOlder,
}:

buildPythonPackage rec {
@@ -15,30 +15,35 @@ buildPythonPackage rec {
  version = "1.2.4";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "KentoNishi";
    repo = "torch-pitch-shift";
    rev = "v${version}";
    rev = "refs/tags/v${version}";
    hash = "sha256-s3z+6jOGC7RfF9TzVZ9HFbIFz2BsBm6Yhx7lgaEKv6o=";
  };

  nativeBuildInputs = [
    setuptools
    wheel
  ];
  pythonRelaxDeps = [ "torchaudio" ];

  propagatedBuildInputs = [
  build-system = [ setuptools ];

  dependencies = [
    packaging
    primepy
    torch
    torchaudio
  ];

  # Module has no tests
  doCheck = false;

  pythonImportsCheck = [ "torch_pitch_shift" ];

  meta = with lib; {
    description = "Pitch-shift audio clips quickly with PyTorch (CUDA supported)! Additional utilities for searching efficient transformations are included";
    homepage = "https://github.com/KentoNishi/torch-pitch-shift";
    changelog = "https://github.com/KentoNishi/torch-pitch-shift/releases/tag/v${version}";
    license = licenses.mit;
    maintainers = with maintainers; [ matthewcroughan ];
  };