Repository: Rikorose/DeepFilterNet (language: python)

Issue:
errors when trying to process wav files on Windows
Hello,
I was trying to test deepfilternet on Windows. I don't know much about the technical aspects or Python in general though, and consequently I am getting errors and I don't know the cause.
I ran these commands from the readme:
pip install torch torchaudio -f https://download.pytorch.org/whl/cpu/torch_stable.html
pip install deepfilternet
(So far, no errors)
deepFilter test.wav
(Test.wav is just a placeholder to the path to a real file)

I tried both with Python 3.10 (latest) and 3.7 as suggested by the deepfilterlib page on pypi. In both cases I get errors that no audio backend is available, and that libdf couldn't be found.
Any advice would be greatly appreciated. Thanks in advance!


Discussion / hints:
Hi could you provide some stack traces showing the full error messages?

No audio backend is related to torch audio. You mal have a look in their documentation. 
Thanks for your reply.
I needed to install PySoundFile. Now the audio backend error is gone, but libdf error still remains. The traceback is below:
Traceback (most recent call last):
  File "c:\users\raymond\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\raymond\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Raymond\AppData\Local\Programs\Python\Python37\Scripts\deepFilter.exe\__main__.py", line 4, in <module>
  File "c:\users\raymond\appdata\local\programs\python\python37\lib\site-packages\df\enhance.py", line 17, in <module>
    from df.checkpoint import load_model as load_model_cp
  File "c:\users\raymond\appdata\local\programs\python\python37\lib\site-packages\df\checkpoint.py", line 14, in <module>
    from libdf import DF
  File "c:\users\raymond\appdata\local\programs\python\python37\lib\site-packages\libdf\__init__.py", line 1, in <module>
    from .libdf import *
ImportError: DLL load failed: The specified module could not be found.

Which deep filter version are you using?
Could you try reinstalling deepfilterlib: `pip install -U deepfilterlib`.

I don't have access to a windows machine, but in CI, windows is working. You may also have a look at the CI: https://github.com/Rikorose/DeepFilterNet/blob/main/.github/workflows/test_df.yml
I tried updating.
Requirement already up-to-date: deepfilterlib in c:\users\raymond\appdata\local\programs\python\python37\lib\site-packages (0.2.3)
Requirement already satisfied, skipping upgrade: numpy>=1.20 in c:\users\raymond\appdata\local\programs\python\python37\lib\site-packages (from deepfilterlib) (1.21.6)
I'm not familiar with how to test with CI and using the yml configs and stuff, but I'll look into it and see if I can figure something out.

Fix patch:
diff --git a/.github/workflows/cross_compile.yml b/.github/workflows/cross_compile.yml
index 100d0f917..0444c4874 100644
--- a/.github/workflows/cross_compile.yml
+++ b/.github/workflows/cross_compile.yml
@@ -16,7 +16,7 @@ jobs:
     name: Test Cross Compile
     runs-on: ubuntu-latest
     strategy:
-      fail-fast: false
+      fail-fast: true
       matrix:
         rust: [stable]
         manylinux: [2014]
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index ee7a3c444..9dfcd2406 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -47,7 +47,13 @@ jobs:
             df_wheel: pyDF-data
     steps:
       - name: Checkout DeepFilterNet
-        uses: actions/checkout@v1
+        uses: actions/checkout@v2
+
+      - name: Echo git tag
+        run: |
+          echo "git tag: ${{github.event.head_commit.message}}"
+          echo "DF version:  $(scripts/get_version.sh)"
+          echo "DF_VERSION=$(scripts/get_version.sh)" >> $GITHUB_ENV
 
       - name: Install HDF5
         if: matrix.os == 'ubuntu-latest' && matrix.df_wheel == 'pyDF-data'
@@ -92,6 +98,8 @@ jobs:
         if: matrix.os == 'windows-latest'
         run: |
           maturin build --release --target=${{ matrix.target }} -m ${{ matrix.df_wheel }}/Cargo.toml -i python.exe
+          pip install delvewheel
+          delvewheel repair target/wheels/DeepFilterLib-*.whl
 
       - uses: actions/upload-artifact@v2
         with:
@@ -142,5 +150,5 @@ jobs:
           USER: ${{ secrets.PYPI_USER }}
           PW: ${{ secrets.PYPI_PW }}
         run: |
-          maturin upload -u "$USER" -p "$PW" libdf-wheels/*
-          maturin upload -u "$USER" -p "$PW" deepfilternet-wheels/*
+          maturin upload -u "$USER" -p "$PW" libdf-wheels/*"DF_VERSION"*
+          maturin upload -u "$USER" -p "$PW" deepfilternet-wheels/*"DF_VERSION"*
diff --git a/scripts/get_version.sh b/scripts/get_version.sh
new file mode 100755
index 000000000..694e9b538
--- /dev/null
+++ b/scripts/get_version.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+grep version DeepFilterNet/pyproject.toml -m 1 | cut -d '=' -f2 | tr -d ' "'


Test patch:
diff --git a/.github/workflows/test_df.yml b/.github/workflows/test_df.yml
index 108b7e9b9..a0a3151da 100644
--- a/.github/workflows/test_df.yml
+++ b/.github/workflows/test_df.yml
@@ -38,7 +38,11 @@ jobs:
         shell: bash
     steps:
       - uses: actions/checkout@v2
-
+      - name: Echo git tag
+        run: |
+          echo "git tag: ${{github.event.head_commit.message}}"
+          echo "DF version:  $(scripts/get_version.sh)"
+          echo "DF_VERSION=$(scripts/get_version.sh)" >> $GITHUB_ENV
       # Aditionally test against original matlab composite metrics
       - name: Set Extra Dependency Ubuntu
         if: matrix.os == 'ubuntu-latest'
diff --git a/.github/workflows/test_pypi_release.yml b/.github/workflows/test_pypi_release.yml
new file mode 100644
index 000000000..f3198b50e
--- /dev/null
+++ b/.github/workflows/test_pypi_release.yml
@@ -0,0 +1,59 @@
+name: Test PyPi
+
+on:
+  workflow_run:
+    workflows: ["publish-pypi-wheels"]
+    branches: [main]
+    types:
+      - completed
+  schedule:
+    - cron: '0 18 * * 0'
+
+jobs:
+  test-df-output:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        python: ["3.9"]
+        os: ["ubuntu-latest", "macos-latest", "windows-latest"]
+    defaults:
+      run:
+        shell: bash
+    steps:
+      - uses: actions/checkout@v3
+      # Python and poetry install
+      - name: Install Python
+        uses: actions/setup-python@v3
+        with:
+          cache: 'pip'
+          cache-dependency-path: '**/requirements.txt'
+          python-version: ${{ matrix.python }}
+      - name: Update PATH
+        if: ${{ matrix.os != 'windows-latest' }}
+        run: echo "$HOME/.local/bin" >> $GITHUB_PATH
+      - name: Update Path for Windows and Windows Deps
+        if: ${{ matrix.os == 'windows-latest' }}
+        run: |
+          echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH
+          pip install soundfile
+          pip install msvc-runtime
+      - name: Install DeepFilterNet and Deps
+        run: |
+          pip install torch torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
+          pip install deepfilternet requests
+          pip install -r DeepFilterNet/requirements_test.txt
+      # Test deepFilter executable
+      - name: Test deepFilter script
+        working-directory: DeepFilterNet
+        env:
+          DNS_AUTH_KEY: ${{ secrets.DNS_AUTH_KEY }}
+        run: |
+          mkdir ../out
+          deepFilter ../assets/noisy_snr0.wav -o ../out
+          python df/scripts/dnsmos.py ../assets/noisy_snr0.wav -t 2.9511659145355225
+          python df/scripts/dnsmos.py ../out/noisy_snr0_DeepFilterNet2.wav -t 3.7940118312835693
+      - uses: actions/upload-artifact@v2
+        with:
+          name: enhanced-${{ runner.os }}
+          path: out/*wav