From 86e56f2b50307a4a5a4e1d953f8e688df949b3fb Mon Sep 17 00:00:00 2001 From: shahules786 Date: Thu, 6 Oct 2022 11:29:35 +0530 Subject: [PATCH 1/9] fix window type --- enhancer/data/fileprocessor.py | 4 ++++ enhancer/inference.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/enhancer/data/fileprocessor.py b/enhancer/data/fileprocessor.py index 66d4d75..03afc73 100644 --- a/enhancer/data/fileprocessor.py +++ b/enhancer/data/fileprocessor.py @@ -98,6 +98,10 @@ class Fileprocessor: return cls(clean_dir, noisy_dir, ProcessorFunctions.one_to_one) elif name.lower() == "dns-2020": return cls(clean_dir, noisy_dir, ProcessorFunctions.one_to_many) + else: + raise ValueError( + f"Invalid matching function, Please use valid matching function from {MATCHING_FNS}" + ) else: if matching_function not in MATCHING_FNS: raise ValueError( diff --git a/enhancer/inference.py b/enhancer/inference.py index ae399f1..fd3b518 100644 --- a/enhancer/inference.py +++ b/enhancer/inference.py @@ -91,7 +91,7 @@ class Inference: window_size: int, total_frames: int, step_size: Optional[int] = None, - window="hanning", + window="hamming", ): """ stitch batched waveform into single waveform. (Overlap-add) From 8c9511967c9d29f6abb6ef13c8b7a1b17f332bb0 Mon Sep 17 00:00:00 2001 From: shahules786 Date: Thu, 6 Oct 2022 11:29:52 +0530 Subject: [PATCH 2/9] warning fix --- enhancer/models/demucs.py | 2 +- enhancer/models/waveunet.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/enhancer/models/demucs.py b/enhancer/models/demucs.py index 65f119d..bf9d429 100644 --- a/enhancer/models/demucs.py +++ b/enhancer/models/demucs.py @@ -143,7 +143,7 @@ class Demucs(Model): ) if dataset is not None: if sampling_rate != dataset.sampling_rate: - logging.warn( + logging.warning( f"model sampling rate {sampling_rate} should match dataset sampling rate {dataset.sampling_rate}" ) sampling_rate = dataset.sampling_rate diff --git a/enhancer/models/waveunet.py b/enhancer/models/waveunet.py index ebb4b1f..ea5646a 100644 --- a/enhancer/models/waveunet.py +++ b/enhancer/models/waveunet.py @@ -107,7 +107,7 @@ class WaveUnet(Model): ) if dataset is not None: if sampling_rate != dataset.sampling_rate: - logging.warn( + logging.warning( f"model sampling rate {sampling_rate} should match dataset sampling rate {dataset.sampling_rate}" ) sampling_rate = dataset.sampling_rate From 124ee8318064932b702fbb23bd3c3246a5c5d31f Mon Sep 17 00:00:00 2001 From: shahules786 Date: Thu, 6 Oct 2022 11:30:00 +0530 Subject: [PATCH 3/9] fix setter --- enhancer/models/model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enhancer/models/model.py b/enhancer/models/model.py index 39dbe80..6e6b4e1 100644 --- a/enhancer/models/model.py +++ b/enhancer/models/model.py @@ -74,9 +74,9 @@ class Model(pl.LightningModule): def loss(self, loss): if isinstance(loss, str): - losses = [loss] + loss = [loss] - self._loss = Avergeloss(losses) + self._loss = Avergeloss(loss) @property def metric(self): From 75a2f264cd8b6c68a99506af6d98760b8dc9b9df Mon Sep 17 00:00:00 2001 From: shahules786 Date: Thu, 6 Oct 2022 11:30:11 +0530 Subject: [PATCH 4/9] requirements --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index a16acec..3ba763a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,8 @@ librosa>=0.9.2 mlflow>=1.29.0 numpy>=1.23.3 protobuf>=3.19.6 +pytest>=7.1.3 +pytest-lazy-fixture>=0.6.3 pytorch-lightning>=1.7.7 scikit-learn>=1.1.2 scipy>=1.9.1 From 8da721308fefbf193a15fd6012df591293efc1ea Mon Sep 17 00:00:00 2001 From: shahules786 Date: Thu, 6 Oct 2022 11:30:21 +0530 Subject: [PATCH 5/9] fix tests utils --- tests/utils_test.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/utils_test.py b/tests/utils_test.py index 65c723d..cd5240c 100644 --- a/tests/utils_test.py +++ b/tests/utils_test.py @@ -31,7 +31,6 @@ def test_fileprocessor_vctk(): "vctk", "tests/data/vctk/clean_testset_wav", "tests/data/vctk/noisy_testset_wav", - 48000, ) matching_dict = fp.prepare_matching_dict() assert len(matching_dict) == 2 @@ -39,7 +38,7 @@ def test_fileprocessor_vctk(): @pytest.mark.parametrize("dataset_name", ["vctk", "dns-2020"]) def test_fileprocessor_names(dataset_name): - fp = Fileprocessor.from_name(dataset_name, "clean_dir", "noisy_dir", 16000) + fp = Fileprocessor.from_name(dataset_name, "clean_dir", "noisy_dir") assert hasattr(fp.matching_function, "__call__") From 06ccbb86342cf4f3a8c445aec2ced1cbdbbb2438 Mon Sep 17 00:00:00 2001 From: shahules786 Date: Thu, 6 Oct 2022 11:31:43 +0530 Subject: [PATCH 6/9] ci/cd --- .github/workflows/ci.yaml | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..f07c39e --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,49 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Enhancer + +on: + push: + branches: [ dev ] + pull_request: + branches: [ dev ] +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8] + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v1.1.1 + env : + ACTIONS_ALLOW_UNSECURE_COMMANDS : true + with: + python-version: ${{ matrix.python-version }} + - name: Cache pip + uses: actions/cache@v1 + with: + path: ~/.cache/pip # This path is specific to Ubuntu + # Look to see if there is a cache hit for the corresponding requirements file + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + # You can test your matrix by printing the current Python version + - name: Display Python version + run: python -c "import sys; print(sys.version)" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install black flake8 pytest + - name: Run black + run: + black --check . + - name: Run flake8 + run: flake8 + - name: Test with pytest + run: | + pytest tests \ No newline at end of file From 9b3359d3ec943360d9d06fcdaf20b8d3b922587d Mon Sep 17 00:00:00 2001 From: shahules786 Date: Thu, 6 Oct 2022 11:32:55 +0530 Subject: [PATCH 7/9] fix yml --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f07c39e..25c74d5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,5 +45,5 @@ jobs: - name: Run flake8 run: flake8 - name: Test with pytest - run: | + run: pytest tests \ No newline at end of file From eb7d09f375c0433a4ce9fcd13882b137e2e43553 Mon Sep 17 00:00:00 2001 From: shahules786 Date: Thu, 6 Oct 2022 11:40:28 +0530 Subject: [PATCH 8/9] add coverage --- .github/workflows/ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 25c74d5..6b3c716 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v2 - name: Set up Python uses: actions/setup-python@v1.1.1 - env : + env : ACTIONS_ALLOW_UNSECURE_COMMANDS : true with: python-version: ${{ matrix.python-version }} @@ -38,12 +38,12 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt - pip install black flake8 pytest + pip install black flake8 pytest-cov - name: Run black run: black --check . - name: Run flake8 run: flake8 - name: Test with pytest - run: - pytest tests \ No newline at end of file + run: + pytest tests --cov=enhancer/ From 972ddfdc034ce2518ecd62240593219c2f7beda7 Mon Sep 17 00:00:00 2001 From: shahules786 Date: Thu, 6 Oct 2022 11:49:12 +0530 Subject: [PATCH 9/9] requirements --- requirements.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 3ba763a..bb13983 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,4 @@ -black>=22.8.0 boto3>=1.24.86 -flake8>=5.0.4 huggingface-hub>=0.10.0 hydra-core>=1.2.0 joblib>=1.2.0 @@ -8,8 +6,6 @@ librosa>=0.9.2 mlflow>=1.29.0 numpy>=1.23.3 protobuf>=3.19.6 -pytest>=7.1.3 -pytest-lazy-fixture>=0.6.3 pytorch-lightning>=1.7.7 scikit-learn>=1.1.2 scipy>=1.9.1