From 50b21d4b2fdbf87a07d9158655d25feacfab678b Mon Sep 17 00:00:00 2001 From: ibevers Date: Wed, 19 Jun 2024 06:34:45 -0400 Subject: [PATCH 1/4] fix: fix support for NumPy 2.0.0 --- CHANGELOG.md | 6 ++++++ pyannote/audio/core/inference.py | 2 +- pyannote/audio/tasks/segmentation/mixins.py | 2 +- pyannote/audio/tasks/segmentation/speaker_diarization.py | 2 +- pyannote/audio/tasks/separation/PixIT.py | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 438f87bfb..f29a13450 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## develop + +### Fixes + +- fix: fix support for `numpy==2.x` ([@ibevers](https://github.com/ibevers/)) + ## Version 3.3.0 (2024-06-14) ### TL;DR diff --git a/pyannote/audio/core/inference.py b/pyannote/audio/core/inference.py index e43e94f98..5155d55e6 100644 --- a/pyannote/audio/core/inference.py +++ b/pyannote/audio/core/inference.py @@ -526,7 +526,7 @@ def aggregate( warm_up: Tuple[float, float] = (0.0, 0.0), epsilon: float = 1e-12, hamming: bool = False, - missing: float = np.NaN, + missing: float = np.nan, skip_average: bool = False, ) -> SlidingWindowFeature: """Aggregation diff --git a/pyannote/audio/tasks/segmentation/mixins.py b/pyannote/audio/tasks/segmentation/mixins.py index be30828f0..cf6e3004a 100644 --- a/pyannote/audio/tasks/segmentation/mixins.py +++ b/pyannote/audio/tasks/segmentation/mixins.py @@ -401,7 +401,7 @@ def validation_step(self, batch, batch_idx: int): ) # reshape target so that there is one line per class when plotting it - y[y == 0] = np.NaN + y[y == 0] = np.nan if len(y.shape) == 2: y = y[:, :, np.newaxis] y *= np.arange(y.shape[2]) diff --git a/pyannote/audio/tasks/segmentation/speaker_diarization.py b/pyannote/audio/tasks/segmentation/speaker_diarization.py index 8a091b1f7..fb0b9b979 100644 --- a/pyannote/audio/tasks/segmentation/speaker_diarization.py +++ b/pyannote/audio/tasks/segmentation/speaker_diarization.py @@ -818,7 +818,7 @@ def validation_step(self, batch, batch_idx: int): ) # reshape target so that there is one line per class when plotting it - y[y == 0] = np.NaN + y[y == 0] = np.nan if len(y.shape) == 2: y = y[:, :, np.newaxis] y *= np.arange(y.shape[2]) diff --git a/pyannote/audio/tasks/separation/PixIT.py b/pyannote/audio/tasks/separation/PixIT.py index b181d7711..cc647ee63 100644 --- a/pyannote/audio/tasks/separation/PixIT.py +++ b/pyannote/audio/tasks/separation/PixIT.py @@ -1136,7 +1136,7 @@ def validation_step(self, batch, batch_idx: int): ) # reshape target so that there is one line per class when plotting it - y[y == 0] = np.NaN + y[y == 0] = np.nan if len(y.shape) == 2: y = y[:, :, np.newaxis] y *= np.arange(y.shape[2]) From 1a5b870a90f0a83eabde42f0377f5214d53d2439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20BREDIN?= Date: Wed, 19 Jun 2024 07:03:24 -0400 Subject: [PATCH 2/4] setup: drop support for Python 3.8 (#1728) --- .github/workflows/test.yml | 2 +- CHANGELOG.md | 4 ++++ setup.cfg | 2 +- setup.py | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e649027ae..d4b21d489 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.8, 3.9, "3.10"] + python-version: ["3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} diff --git a/CHANGELOG.md b/CHANGELOG.md index f29a13450..83601072e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - fix: fix support for `numpy==2.x` ([@ibevers](https://github.com/ibevers/)) +### Breaking changes + +- setup: drop support for Python 3.8 + ## Version 3.3.0 (2024-06-14) ### TL;DR diff --git a/setup.cfg b/setup.cfg index 1ae4b0d6c..ef7fbc487 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,7 +27,7 @@ setup_requires = pyscaffold>=3.2a0,<3.3a0 # Add here dependencies of your project (semicolon/line-separated), e.g. # install_requires = numpy; scipy # Require a specific Python version, e.g. Python 2.7 or >= 3.4 -python_requires = >=3.7 +python_requires = >=3.9 [options.packages.find] where = . diff --git a/setup.py b/setup.py index 4eaa0b055..768899270 100644 --- a/setup.py +++ b/setup.py @@ -56,9 +56,9 @@ "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Natural Language :: English", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering", ], ) From bd7b977c21611b1f76ec4227cf247febda624afc Mon Sep 17 00:00:00 2001 From: Adel Moumen <88119391+Adel-Moumen@users.noreply.github.com> Date: Wed, 19 Jun 2024 07:58:31 -0400 Subject: [PATCH 3/4] fix: fix support for `speechbrain==1.0` (#1659) * fixes #1727 * fixes #1677 --- CHANGELOG.md | 1 + .../audio/pipelines/speaker_verification.py | 2 +- requirements.txt | 2 +- tests/test_speechbrain.py | 20 +++++++++++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 tests/test_speechbrain.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 83601072e..2b54ab746 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixes - fix: fix support for `numpy==2.x` ([@ibevers](https://github.com/ibevers/)) +- fix: fix support for `speechbrain==1.x` ([@Adel-Moumen](https://github.com/Adel-Moumen/)) ### Breaking changes diff --git a/pyannote/audio/pipelines/speaker_verification.py b/pyannote/audio/pipelines/speaker_verification.py index 8c4139b6f..022c1ca6f 100644 --- a/pyannote/audio/pipelines/speaker_verification.py +++ b/pyannote/audio/pipelines/speaker_verification.py @@ -40,7 +40,7 @@ from pyannote.audio.pipelines.utils import PipelineModel, get_model try: - from speechbrain.pretrained import ( + from speechbrain.inference import ( EncoderClassifier as SpeechBrain_EncoderClassifier, ) diff --git a/requirements.txt b/requirements.txt index 3a0aa74dc..5083258cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ pytorch_metric_learning >= 2.1.0 rich >= 12.0.0 semver >= 3.0.0 soundfile >= 0.12.1 -speechbrain >= 0.5.14 +speechbrain >= 1.0.0 tensorboardX >= 2.6 torch >= 2.0.0 torch_audiomentations >= 0.11.0 diff --git a/tests/test_speechbrain.py b/tests/test_speechbrain.py new file mode 100644 index 000000000..0ac9b60cf --- /dev/null +++ b/tests/test_speechbrain.py @@ -0,0 +1,20 @@ +import tempfile +import pytest +from speechbrain.inference import EncoderClassifier + + +@pytest.fixture() +def cache(): + return tempfile.mkdtemp() + +def test_import_speechbrain_encoder_classifier(cache): + """This is a simple test that check if speechbrain + EncoderClassifier can be imported. It does not check + if the model is working properly. + """ + + model = EncoderClassifier.from_hparams( + source="speechbrain/spkrec-ecapa-voxceleb", + savedir=cache, + ) + assert isinstance(model, EncoderClassifier) From 82f345a3df5ea5cdcf0b8e24f8d090e4bddc3765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20BREDIN?= Date: Wed, 19 Jun 2024 14:01:24 +0200 Subject: [PATCH 4/4] doc: update changelog and bump version --- CHANGELOG.md | 10 ++++++---- version.txt | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b54ab746..c9a271a67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,17 @@ # Changelog -## develop + +## Version 3.3.1 (2024-06-19) + +### Breaking changes + +- setup: drop support for Python 3.8 ### Fixes - fix: fix support for `numpy==2.x` ([@ibevers](https://github.com/ibevers/)) - fix: fix support for `speechbrain==1.x` ([@Adel-Moumen](https://github.com/Adel-Moumen/)) -### Breaking changes - -- setup: drop support for Python 3.8 ## Version 3.3.0 (2024-06-14) diff --git a/version.txt b/version.txt index 15a279981..bea438e9a 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -3.3.0 +3.3.1