Skip to content

Commit

Permalink
Fix missing tqdm dependency for cli test (#81)
Browse files Browse the repository at this point in the history
* add simple cli workflow

* add tqdm, rename test

* update version

* add averagemeter and earlystopping tests

* remove 3.6 from unit tests (keeping cli test 3.6)
  • Loading branch information
faroit authored Apr 19, 2021
1 parent 2aa3fe2 commit 1b77add
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 7 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/test_cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: UMX
# thanks for @mpariente for copying this workflow
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
# Trigger the workflow on push or pull request
on: [push, pull_request]

jobs:
src-test:
name: separation test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]

# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install libnsdfile, ffmpeg and sox
run: |
sudo apt update
sudo apt install libsndfile1-dev libsndfile1 ffmpeg sox
- name: Install package dependencies
run: |
python -m pip install --upgrade --user pip --quiet
python -m pip install .["stempeg"]
python --version
pip --version
python -m pip list
- name: CLI tests
run: |
umx https://samples.ffmpeg.org/A-codecs/wavpcm/test-96.wav --audio-backend stempeg
2 changes: 1 addition & 1 deletion .github/workflows/test_unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.7, 3.8]
pytorch-version: ["1.8.0"]

# Timeout: https://stackoverflow.com/a/59076067/4521646
Expand Down
8 changes: 2 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

umx_version = "1.1.1"
umx_version = "1.1.2"

with open("README.md", encoding="utf-8") as fh:
long_description = fh.read()
Expand All @@ -16,11 +16,7 @@
long_description_content_type="text/markdown",
license="MIT",
python_requires=">=3.6",
install_requires=[
"numpy",
"torchaudio>=0.8.0",
"torch>=1.8.0",
],
install_requires=["numpy", "torchaudio>=0.8.0", "torch>=1.8.0", "tqdm"],
extras_require={
"asteroid": ["asteroid-filterbanks>=0.3.2"],
"tests": [
Expand Down
17 changes: 17 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from openunmix.utils import AverageMeter, EarlyStopping


def test_average_meter():
losses = AverageMeter()
losses.update(1.0)
losses.update(3.0)
assert losses.avg == 2.0


def test_early_stopping():
es = EarlyStopping(patience=2)
es.step(1.0)

assert not es.step(0.5)
assert not es.step(0.6)
assert es.step(0.7)

0 comments on commit 1b77add

Please sign in to comment.