From da4d70d7affc477eb8dc3a51f9b13d387817059a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20=C5=BBelasko?= Date: Tue, 25 Jun 2024 11:54:29 -0400 Subject: [PATCH] Numpy 2.0 compatibility (#1362) * Remove numpy version limit * Bump CI torch version in some tests * Upgrade torch version in most CI tests, fix one failing test with numpy 2.0 * remove kaldifeat from python3.9 CI due to compilation issues --- .github/workflows/missing_torchaudio.yml | 6 +++--- .github/workflows/unit_tests.yml | 12 ++++++------ test/cut/test_padding_cut.py | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/missing_torchaudio.yml b/.github/workflows/missing_torchaudio.yml index 1f51cfc5d..d665c3b66 100644 --- a/.github/workflows/missing_torchaudio.yml +++ b/.github/workflows/missing_torchaudio.yml @@ -16,8 +16,8 @@ jobs: strategy: matrix: include: - - python-version: "3.11" - torch-install-cmd: "pip install torch==2.0 --extra-index-url https://download.pytorch.org/whl/cpu" + - python-version: "3.12" + torch-install-cmd: "pip install torch==2.3 --index-url https://download.pytorch.org/whl/cpu" fail-fast: false @@ -38,7 +38,7 @@ jobs: - name: Install Python dependencies run: | python -m pip install --upgrade pip - pip install wheel 'numpy<2' scipy + pip install wheel numpy scipy # Force the installation of a CPU-only PyTorch ${{ matrix.torch-install-cmd }} # the torchaudio env var does nothing when torchaudio is installed, but doesn't require it's presence when it's not diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 157ea9635..33310c313 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -20,16 +20,16 @@ jobs: torch-install-cmd: "pip install torch==1.12.1 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cpu" extra_deps: kaldifeat - python-version: "3.9" - torch-install-cmd: "pip install torch==2.0 torchaudio==2.0 --extra-index-url https://download.pytorch.org/whl/cpu" - extra_deps: kaldifeat + torch-install-cmd: "pip install torch==2.3 torchaudio==2.3 --extra-index-url https://download.pytorch.org/whl/cpu" + extra_deps: "" - python-version: "3.10" - torch-install-cmd: "pip install torch==2.1 torchaudio==2.1 --extra-index-url https://download.pytorch.org/whl/cpu" + torch-install-cmd: "pip install torch==2.3 torchaudio==2.3 --extra-index-url https://download.pytorch.org/whl/cpu" extra_deps: "" - python-version: "3.11" - torch-install-cmd: "pip install torch==2.2 torchaudio==2.2 --extra-index-url https://download.pytorch.org/whl/cpu" + torch-install-cmd: "pip install torch==2.3 torchaudio==2.3 --extra-index-url https://download.pytorch.org/whl/cpu" extra_deps: "" - python-version: "3.12" - torch-install-cmd: "pip install torch==2.2 torchaudio==2.2 --extra-index-url https://download.pytorch.org/whl/cpu" + torch-install-cmd: "pip install torch==2.3 torchaudio==2.3 --extra-index-url https://download.pytorch.org/whl/cpu" extra_deps: "" fail-fast: false @@ -51,7 +51,7 @@ jobs: - name: Install Python dependencies run: | python -m pip install --upgrade pip - pip install wheel 'numpy<2' + pip install wheel numpy # Force the installation of a CPU-only PyTorch ${{ matrix.torch-install-cmd }} # the torchaudio env var does nothing when torchaudio is installed, but doesn't require it's presence when it's not diff --git a/test/cut/test_padding_cut.py b/test/cut/test_padding_cut.py index 55623d92e..a20ed5eb0 100644 --- a/test/cut/test_padding_cut.py +++ b/test/cut/test_padding_cut.py @@ -33,7 +33,7 @@ def test_load_features_log(padding_cut, expected_value): feats = padding_cut.load_features() assert feats.shape[0] == 1000 assert feats.shape[1] == 40 - np.testing.assert_almost_equal(feats, expected_value) + np.testing.assert_almost_equal(feats, expected_value, decimal=6) def test_frame_shift(padding_cut):