mirror of
https://github.com/YuzuZensai/spleeter.git
synced 2026-01-31 14:58:23 +00:00
Merge branch 'master' into tf2
This commit is contained in:
@@ -1,285 +0,0 @@
|
|||||||
version: 2
|
|
||||||
jobs:
|
|
||||||
# =======================================================================================
|
|
||||||
# Python 3.6 testing.
|
|
||||||
# =======================================================================================
|
|
||||||
test-3.6:
|
|
||||||
docker:
|
|
||||||
- image: python:3.6
|
|
||||||
working_directory: ~/spleeter
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- restore_cache:
|
|
||||||
key: models-{{ checksum "spleeter/model/__init__.py" }}
|
|
||||||
- run: apt-get update && apt-get install -y ffmpeg
|
|
||||||
- run: pip install -r requirements.txt && pip install pytest pytest-xdist musdb museval
|
|
||||||
- run: make test
|
|
||||||
- save_cache:
|
|
||||||
key: models-{{ checksum "spleeter/model/__init__.py" }}
|
|
||||||
paths:
|
|
||||||
- "pretrained_models"
|
|
||||||
# =======================================================================================
|
|
||||||
# Python 3.7 testing.
|
|
||||||
# =======================================================================================
|
|
||||||
test-3.7:
|
|
||||||
docker:
|
|
||||||
- image: python:3.7
|
|
||||||
working_directory: ~/spleeter
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- restore_cache:
|
|
||||||
key: models-{{ checksum "spleeter/model/__init__.py" }}
|
|
||||||
- run: apt-get update && apt-get install -y ffmpeg
|
|
||||||
- run: pip install -r requirements.txt && pip install pytest pytest-xdist musdb museval
|
|
||||||
- run: make test
|
|
||||||
- save_cache:
|
|
||||||
key: models-{{ checksum "spleeter/model/__init__.py" }}
|
|
||||||
paths:
|
|
||||||
- "pretrained_models"
|
|
||||||
# =======================================================================================
|
|
||||||
# Source distribution packaging.
|
|
||||||
# =======================================================================================
|
|
||||||
sdist:
|
|
||||||
docker:
|
|
||||||
- image: python:3
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run: make build
|
|
||||||
- save_cache:
|
|
||||||
key: sdist-{{ .Branch }}-{{ checksum "setup.py" }}
|
|
||||||
paths:
|
|
||||||
- dist
|
|
||||||
sdist-gpu:
|
|
||||||
docker:
|
|
||||||
- image: python:3
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run: make build-gpu
|
|
||||||
- save_cache:
|
|
||||||
key: sdist-{{ .Branch }}-{{ checksum "setup.py" }}
|
|
||||||
paths:
|
|
||||||
- dist
|
|
||||||
# =======================================================================================
|
|
||||||
# PyPi deployment.
|
|
||||||
# =======================================================================================
|
|
||||||
pypi-deploy:
|
|
||||||
docker:
|
|
||||||
- image: python:3
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- restore_cache:
|
|
||||||
key: sdist-{{ .Branch }}-{{ checksum "setup.py" }}
|
|
||||||
- run:
|
|
||||||
name: upload to PyPi
|
|
||||||
# TODO: Infer destination regarding of branch.
|
|
||||||
# - master => production PyPi
|
|
||||||
# - other => testing PyPi
|
|
||||||
command: make build deploy
|
|
||||||
pypi-deploy-gpu:
|
|
||||||
docker:
|
|
||||||
- image: python:3
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- restore_cache:
|
|
||||||
key: sdist-{{ .Branch }}-{{ checksum "setup.py" }}
|
|
||||||
- run:
|
|
||||||
name: upload to PyPi
|
|
||||||
# TODO: Infer destination regarding of branch.
|
|
||||||
# - master => production PyPi
|
|
||||||
# - other => testing PyPi
|
|
||||||
command: make build-gpu deploy
|
|
||||||
# =======================================================================================
|
|
||||||
# Docker build.
|
|
||||||
# =======================================================================================
|
|
||||||
|
|
||||||
docker-conda-cpu:
|
|
||||||
docker:
|
|
||||||
- image: docker:17.05.0-ce-git
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- setup_remote_docker
|
|
||||||
- run: docker build -t conda -f docker/conda.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=conda -t researchdeezer/spleeter:conda -f docker/spleeter-conda.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:conda --build-arg MODEL=2stems -t researchdeezer/spleeter:conda-2stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:conda --build-arg MODEL=4stems -t researchdeezer/spleeter:conda-4stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:conda --build-arg MODEL=5stems -t researchdeezer/spleeter:conda-5stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker run -v $(pwd):/runtime researchdeezer/spleeter:conda separate -i /runtime/audio_example.mp3 -o /tmp
|
|
||||||
- run: docker run -v $(pwd):/runtime researchdeezer/spleeter:conda-2stems separate -i /runtime/audio_example.mp3 -o /tmp
|
|
||||||
- run: docker run -v $(pwd):/runtime researchdeezer/spleeter:conda-4stems separate -i /runtime/audio_example.mp3 -p spleeter:4stems -o /tmp
|
|
||||||
- run: docker run -v $(pwd):/runtime researchdeezer/spleeter:conda-5stems separate -i /runtime/audio_example.mp3 -p spleeter:5stems -o /tmp
|
|
||||||
- run: docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
|
|
||||||
- run: docker push researchdeezer/spleeter:conda
|
|
||||||
- run: docker push researchdeezer/spleeter:conda-2stems
|
|
||||||
- run: docker push researchdeezer/spleeter:conda-4stems
|
|
||||||
- run: docker push researchdeezer/spleeter:conda-5stems
|
|
||||||
docker-conda-gpu:
|
|
||||||
docker:
|
|
||||||
- image: docker:17.05.0-ce-git
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- setup_remote_docker
|
|
||||||
- run: docker build -t conda -f docker/conda.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=conda -t conda-gpu -f docker/cuda-10-0.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=conda-gpu --build-arg SPLEETER_PACKAGE=spleeter-gpu -t researchdeezer/spleeter:conda-gpu -f docker/spleeter-conda.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:conda-gpu --build-arg MODEL=2stems -t researchdeezer/spleeter:conda-gpu-2stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:conda-gpu --build-arg MODEL=4stems -t researchdeezer/spleeter:conda-gpu-4stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:conda-gpu --build-arg MODEL=5stems -t researchdeezer/spleeter:conda-gpu-5stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
|
|
||||||
- run: docker push researchdeezer/spleeter:conda-gpu
|
|
||||||
- run: docker push researchdeezer/spleeter:conda-gpu-2stems
|
|
||||||
- run: docker push researchdeezer/spleeter:conda-gpu-4stems
|
|
||||||
- run: docker push researchdeezer/spleeter:conda-gpu-5stems
|
|
||||||
docker-3.6-cpu:
|
|
||||||
docker:
|
|
||||||
- image: docker:17.05.0-ce-git
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- setup_remote_docker
|
|
||||||
- run: docker build --build-arg BASE=python:3.6 -t researchdeezer/spleeter:3.6 -f docker/spleeter.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:3.6 --build-arg MODEL=2stems -t researchdeezer/spleeter:3.6-2stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:3.6 --build-arg MODEL=4stems -t researchdeezer/spleeter:3.6-4stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:3.6 --build-arg MODEL=5stems -t researchdeezer/spleeter:3.6-5stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker run -v $(pwd):/runtime researchdeezer/spleeter:3.6 separate -i /runtime/audio_example.mp3 -o /tmp
|
|
||||||
- run: docker run -v $(pwd):/runtime researchdeezer/spleeter:3.6-2stems separate -i /runtime/audio_example.mp3 -o /tmp
|
|
||||||
- run: docker run -v $(pwd):/runtime researchdeezer/spleeter:3.6-4stems separate -i /runtime/audio_example.mp3 -p spleeter:4stems -o /tmp
|
|
||||||
- run: docker run -v $(pwd):/runtime researchdeezer/spleeter:3.6-5stems separate -i /runtime/audio_example.mp3 -p spleeter:5stems -o /tmp
|
|
||||||
- run: docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
|
|
||||||
- run: docker push researchdeezer/spleeter:3.6
|
|
||||||
- run: docker push researchdeezer/spleeter:3.6-2stems
|
|
||||||
- run: docker push researchdeezer/spleeter:3.6-4stems
|
|
||||||
- run: docker push researchdeezer/spleeter:3.6-5stems
|
|
||||||
docker-3.6-gpu:
|
|
||||||
docker:
|
|
||||||
- image: docker:17.05.0-ce-git
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- setup_remote_docker
|
|
||||||
- run: docker build --build-arg BASE=python:3.6 -t cuda:3.6 -f docker/cuda-10-0.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=cuda:3.6 --build-arg SPLEETER_PACKAGE=spleeter-gpu -t researchdeezer/spleeter:3.6-gpu -f docker/spleeter.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:3.6-gpu --build-arg MODEL=2stems -t researchdeezer/spleeter:3.6-gpu-2stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:3.6-gpu --build-arg MODEL=4stems -t researchdeezer/spleeter:3.6-gpu-4stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:3.6-gpu --build-arg MODEL=5stems -t researchdeezer/spleeter:3.6-gpu-5stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
|
|
||||||
- run: docker push researchdeezer/spleeter:3.6-gpu
|
|
||||||
- run: docker push researchdeezer/spleeter:3.6-gpu-2stems
|
|
||||||
- run: docker push researchdeezer/spleeter:3.6-gpu-4stems
|
|
||||||
- run: docker push researchdeezer/spleeter:3.6-gpu-5stems
|
|
||||||
docker-3.7-cpu:
|
|
||||||
docker:
|
|
||||||
- image: docker:17.05.0-ce-git
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- setup_remote_docker
|
|
||||||
- run: docker build --build-arg BASE=python:3.7 -t researchdeezer/spleeter:3.7 -f docker/spleeter.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:3.7 --build-arg MODEL=2stems -t researchdeezer/spleeter:3.7-2stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:3.7 --build-arg MODEL=4stems -t researchdeezer/spleeter:3.7-4stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:3.7 --build-arg MODEL=5stems -t researchdeezer/spleeter:3.7-5stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker run -v $(pwd):/runtime researchdeezer/spleeter:3.7 separate -i /runtime/audio_example.mp3 -o /tmp
|
|
||||||
- run: docker run -v $(pwd):/runtime researchdeezer/spleeter:3.7-2stems separate -i /runtime/audio_example.mp3 -o /tmp
|
|
||||||
- run: docker run -v $(pwd):/runtime researchdeezer/spleeter:3.7-4stems separate -i /runtime/audio_example.mp3 -p spleeter:4stems -o /tmp
|
|
||||||
- run: docker run -v $(pwd):/runtime researchdeezer/spleeter:3.7-5stems separate -i /runtime/audio_example.mp3 -p spleeter:5stems -o /tmp
|
|
||||||
- run: docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
|
|
||||||
- run: docker tag researchdeezer/spleeter:3.7 researchdeezer/spleeter:latest
|
|
||||||
- run: docker push researchdeezer/spleeter:latest
|
|
||||||
- run: docker push researchdeezer/spleeter:3.7
|
|
||||||
- run: docker push researchdeezer/spleeter:3.7-2stems
|
|
||||||
- run: docker push researchdeezer/spleeter:3.7-4stems
|
|
||||||
- run: docker push researchdeezer/spleeter:3.7-5stems
|
|
||||||
docker-3.7-gpu:
|
|
||||||
docker:
|
|
||||||
- image: docker:17.05.0-ce-git
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- setup_remote_docker
|
|
||||||
- run: docker build -t cuda:3.7 -f docker/cuda-10-0.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=cuda:3.7 --build-arg SPLEETER_PACKAGE=spleeter-gpu -t researchdeezer/spleeter:3.7-gpu -f docker/spleeter.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:3.7-gpu --build-arg MODEL=2stems -t researchdeezer/spleeter:3.7-gpu-2stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:3.7-gpu --build-arg MODEL=4stems -t researchdeezer/spleeter:3.7-gpu-4stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker build --build-arg BASE=researchdeezer/spleeter:3.7-gpu --build-arg MODEL=5stems -t researchdeezer/spleeter:3.7-gpu-5stems -f docker/spleeter-model.dockerfile .
|
|
||||||
- run: docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
|
|
||||||
- run: docker push researchdeezer/spleeter:3.7-gpu
|
|
||||||
- run: docker push researchdeezer/spleeter:3.7-gpu-2stems
|
|
||||||
- run: docker push researchdeezer/spleeter:3.7-gpu-4stems
|
|
||||||
- run: docker push researchdeezer/spleeter:3.7-gpu-5stems
|
|
||||||
- run: docker tag researchdeezer/spleeter:3.7-gpu researchdeezer/spleeter:gpu
|
|
||||||
- run: docker push researchdeezer/spleeter:gpu
|
|
||||||
|
|
||||||
workflows:
|
|
||||||
version: 2
|
|
||||||
spleeter-release-pipeline:
|
|
||||||
jobs:
|
|
||||||
- test-3.6
|
|
||||||
- test-3.7
|
|
||||||
- sdist:
|
|
||||||
requires:
|
|
||||||
- test-3.6
|
|
||||||
- test-3.7
|
|
||||||
- sdist-gpu:
|
|
||||||
requires:
|
|
||||||
- test-3.6
|
|
||||||
- test-3.7
|
|
||||||
- pypi-deploy:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
requires:
|
|
||||||
- sdist
|
|
||||||
- pypi-deploy-gpu:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
requires:
|
|
||||||
- sdist-gpu
|
|
||||||
- conda-forge-validation:
|
|
||||||
type: approval
|
|
||||||
requires:
|
|
||||||
- pypi-deploy
|
|
||||||
- pypi-deploy-gpu
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- docker-conda-cpu:
|
|
||||||
requires:
|
|
||||||
- conda-forge-validation
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- docker-conda-gpu:
|
|
||||||
requires:
|
|
||||||
- conda-forge-validation
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- docker-3.6-cpu:
|
|
||||||
requires:
|
|
||||||
- pypi-deploy
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- docker-3.6-gpu:
|
|
||||||
requires:
|
|
||||||
- pypi-deploy-gpu
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- docker-3.7-cpu:
|
|
||||||
requires:
|
|
||||||
- pypi-deploy
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- docker-3.7-gpu:
|
|
||||||
requires:
|
|
||||||
- pypi-deploy-gpu
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
@@ -14,7 +14,7 @@ Those are the main contributing guidelines for contributing to this project:
|
|||||||
In order to contribute, the safest is to create your [own fork of spleeter](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) first. The following set of commands will clone this new repository, create a virtual environment provisioned with the dependencies and run the tests (will take a few minutes):
|
In order to contribute, the safest is to create your [own fork of spleeter](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) first. The following set of commands will clone this new repository, create a virtual environment provisioned with the dependencies and run the tests (will take a few minutes):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/<your_name>/spleeter
|
git clone https://github.com/<your_name>/spleeter && cd spleeter
|
||||||
python -m venv spleeterenv && source spleeterenv/bin/activate
|
python -m venv spleeterenv && source spleeterenv/bin/activate
|
||||||
pip install -r requirements.txt && pip install pytest pytest-xdist
|
pip install -r requirements.txt && pip install pytest pytest-xdist
|
||||||
make test
|
make test
|
||||||
|
|||||||
81
.github/workflows/docker.yml
vendored
Normal file
81
.github/workflows/docker.yml
vendored
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
name: docker
|
||||||
|
on:
|
||||||
|
- workflow_dispatch
|
||||||
|
jobs:
|
||||||
|
build-test-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
platform: [cpu, gpu]
|
||||||
|
distribution: [3.6, 3.7, conda]
|
||||||
|
model: [modelless, 2stems, 4stems, 5stems]
|
||||||
|
fail-fast: true
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Note: base image building and env setup.
|
||||||
|
- name: Setup Python distribution
|
||||||
|
run: |
|
||||||
|
echo "::set-env name=base::python:${{ matrix.distribution }}"
|
||||||
|
echo "::set-env name=tag::${{ matrix.distribution }}"
|
||||||
|
echo "::set-env name=file::spleeter"
|
||||||
|
echo "::set-env name=package::spleeter"
|
||||||
|
- if: ${{ matrix.distribution == 'conda' }}
|
||||||
|
name: Build Conda base image
|
||||||
|
run: |
|
||||||
|
docker build -t python:conda -f docker/conda.dockerfile .
|
||||||
|
echo "::set-env name=file::spleeter-conda"
|
||||||
|
- if: ${{ matrix.platform == 'gpu' }}
|
||||||
|
name: Build CUDA base image
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
--build-arg BASE=python:${{ matrix.distribution }} \
|
||||||
|
-t cuda:${{ matrix.distribution }} \
|
||||||
|
-f docker/cuda-10-0.dockerfile .
|
||||||
|
echo "::set-env name=base::cuda:${{ matrix.distribution }}"
|
||||||
|
echo "::set-env name=tag::${{ matrix.distribution }}-gpu"
|
||||||
|
echo "::set-env name=package::spleeter-gpu"
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Note: image building.
|
||||||
|
- name: Build deezer/spleeter:${{ env.tag }} image
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
--build-arg BASE=${{ env.base }} \
|
||||||
|
--build-arg SPLEETER_PACKAGE=${{ env.package }} \
|
||||||
|
-t deezer/spleeter:${{ env.tag }} \
|
||||||
|
-f docker/${{ env.file }}.dockerfile .
|
||||||
|
echo "::set-env name=modelargs::"
|
||||||
|
- if: ${{ matrix.model != 'modelless' }}
|
||||||
|
name: Build deezer/spleeter:${{ env.tag }}-${{ matrix.model }} image
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
--build-arg BASE=deezer/spleeter:${{ env.tag }} \
|
||||||
|
--build-arg MODEL=${{ matrix.model }} \
|
||||||
|
-t deezer/spleeter:${{ env.tag }}-${{ matrix.model }} \
|
||||||
|
-f docker/spleeter-model.dockerfile .
|
||||||
|
echo "::set-env name=tag::${{ env.tag }}-${{ matrix.model }}"
|
||||||
|
echo "::set-env name=modelarg::-p spleeter:${{ matrix.model }}"
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Note: image testing.
|
||||||
|
- name: Test deezer/spleeter:${{ env.tag }} image
|
||||||
|
run: |
|
||||||
|
docker run \
|
||||||
|
-v $(pwd):/runtime \
|
||||||
|
deezer/spleeter:${{ env.tag }} \
|
||||||
|
separate -i /runtime/audio_example.mp3 -o /tmp \${{ env.modelarg }}
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Note: image deploy.
|
||||||
|
- name: Docker login
|
||||||
|
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
|
||||||
|
- name: Push deezer/spleeter:${{ env.tag }} image
|
||||||
|
run: docker push deezer/spleeter:${{ env.tag }}
|
||||||
|
- if: ${{ env.tag == 'spleeter:3.7' }}
|
||||||
|
name: Push deezer/spleeter:latest image
|
||||||
|
run: |
|
||||||
|
docker tag deezer/spleeter:3.7 deezer/spleeter:latest
|
||||||
|
docker push deezer/spleeter:latest
|
||||||
|
- if: ${{ env.tag == 'spleeter:3.7-gpu' }}
|
||||||
|
name: Push deezer/spleeter:gpu image
|
||||||
|
run: |
|
||||||
|
docker tag deezer/spleeter:3.7-gpu deezer/spleeter:gpu
|
||||||
|
docker push deezer/spleeter:gpu
|
||||||
43
.github/workflows/pypi.yml
vendored
Normal file
43
.github/workflows/pypi.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
name: pypi
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
env:
|
||||||
|
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
|
||||||
|
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
|
||||||
|
jobs:
|
||||||
|
package-and-deploy:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
platform: [cpu, gpu]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: 3.7
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ env.GITHUB_WORKSPACE }}/dist
|
||||||
|
key: sdist-${{ matrix.platform }}-${{ hashFiles('**/setup.py') }}
|
||||||
|
restore-keys: |
|
||||||
|
sdist-${{ matrix.platform }}-${{ hashFiles('**/setup.py') }}
|
||||||
|
sdist-${{ matrix.platform }}
|
||||||
|
sdist-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pip install --upgrade pip setuptools twine
|
||||||
|
- if: ${{ matrix.platform == 'cpu' }}
|
||||||
|
name: Package CPU distribution
|
||||||
|
run: make build
|
||||||
|
- if: ${{ matrix.platform == 'gpu' }}
|
||||||
|
name: Package GPU distribution)
|
||||||
|
run: make build-gpu
|
||||||
|
- name: Deploy to pypi
|
||||||
|
run: make deploy
|
||||||
41
.github/workflows/pytest.yml
vendored
Normal file
41
.github/workflows/pytest.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
name: pytest
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [3.6, 3.7]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
id: spleeter-pip-cache
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
env:
|
||||||
|
model-release: 1
|
||||||
|
id: spleeter-model-cache
|
||||||
|
with:
|
||||||
|
path: ${{ env.GITHUB_WORKSPACE }}/pretrained_models
|
||||||
|
key: models-${{ env.model-release }}
|
||||||
|
restore-keys: |
|
||||||
|
models-${{ env.model-release }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update && sudo apt-get install -y ffmpeg
|
||||||
|
pip install --upgrade pip setuptools
|
||||||
|
pip install pytest==5.4.3 pytest-xdist==1.32.0 pytest-forked==1.1.3 musdb museval
|
||||||
|
python setup.py install
|
||||||
|
- name: Test with pytest
|
||||||
|
run: make test
|
||||||
@@ -1,5 +1,12 @@
|
|||||||
# Changelog History
|
# Changelog History
|
||||||
|
|
||||||
|
## 1.5.4
|
||||||
|
|
||||||
|
First release, July 24th 2020
|
||||||
|
|
||||||
|
Add some padding of the input waveform to avoid separation artefacts on the edges due to unstabilities in the inverse fourier transforms.
|
||||||
|
Also add tests to ensure both librosa and tensorflow backends have same outputs.
|
||||||
|
|
||||||
## 1.5.2
|
## 1.5.2
|
||||||
|
|
||||||
First released, May 15th 2020
|
First released, May 15th 2020
|
||||||
|
|||||||
5
Makefile
5
Makefile
@@ -1,7 +1,7 @@
|
|||||||
# =======================================================
|
# =======================================================
|
||||||
# Library lifecycle management.
|
# Library lifecycle management.
|
||||||
#
|
#
|
||||||
# @author Deezer Research <research@deezer.com>
|
# @author Deezer Research <spleeter@deezer.com>
|
||||||
# @licence MIT Licence
|
# @licence MIT Licence
|
||||||
# =======================================================
|
# =======================================================
|
||||||
|
|
||||||
@@ -27,8 +27,7 @@ build-gpu: clean
|
|||||||
python3 setup.py sdist
|
python3 setup.py sdist
|
||||||
|
|
||||||
test:
|
test:
|
||||||
$(PYTEST_CMD)
|
$(PYTEST_CMD) tests/
|
||||||
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
pip install twine
|
pip install twine
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<img src="https://github.com/deezer/spleeter/raw/master/images/spleeter_logo.png" height="80" />
|
<img src="https://github.com/deezer/spleeter/raw/master/images/spleeter_logo.png" height="80" />
|
||||||
|
|
||||||
[](https://circleci.com/gh/deezer/spleeter/tree/master)  [](https://badge.fury.io/py/spleeter) [](https://anaconda.org/conda-forge/spleeter) [](https://hub.docker.com/r/researchdeezer/spleeter) [](https://colab.research.google.com/github/deezer/spleeter/blob/master/spleeter.ipynb) [](https://gitter.im/spleeter/community) [](https://joss.theoj.org/papers/259e5efe669945a343bad6eccb89018b)
|
[](https://github.com/deezer/spleeter/actions)  [](https://badge.fury.io/py/spleeter) [](https://anaconda.org/conda-forge/spleeter) [](https://hub.docker.com/r/researchdeezer/spleeter) [](https://colab.research.google.com/github/deezer/spleeter/blob/master/spleeter.ipynb) [](https://gitter.im/spleeter/community) [](https://joss.theoj.org/papers/259e5efe669945a343bad6eccb89018b)
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
@@ -45,9 +45,9 @@ For a detailed documentation, please check the [repository wiki](https://github.
|
|||||||
The following set of commands will clone this repository, create a virtual environment provisioned with the dependencies and run the tests (will take a few minutes):
|
The following set of commands will clone this repository, create a virtual environment provisioned with the dependencies and run the tests (will take a few minutes):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/Deezer/spleeter
|
git clone https://github.com/Deezer/spleeter && cd spleeter
|
||||||
python -m venv spleeterenv && source spleeterenv/bin/activate
|
python -m venv spleeterenv && source spleeterenv/bin/activate
|
||||||
pip install -r requirements.txt && pip install pytest pytest-xdist
|
pip install . && pip install pytest pytest-xdist
|
||||||
make test
|
make test
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ As is commonly the case with open-source projects, there are multiple forks expo
|
|||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
If you would like to participate in the development of **spleeter** your are more than welcome to do so. Don't hesitate to throw us a pull request and we'll do our best to examine it quickly. Please check out our [guidelines](.github/CONTRIBUTING.md) first.
|
If you would like to participate in the development of **spleeter** you are more than welcome to do so. Don't hesitate to throw us a pull request and we'll do our best to examine it quickly. Please check out our [guidelines](.github/CONTRIBUTING.md) first.
|
||||||
|
|
||||||
## Note
|
## Note
|
||||||
|
|
||||||
|
|||||||
45
docker/cuda-10-1.dockerfile
Normal file
45
docker/cuda-10-1.dockerfile
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
ARG BASE=python:3.8
|
||||||
|
FROM ${BASE}
|
||||||
|
|
||||||
|
ENV CUDA_VERSION 10.1.243
|
||||||
|
ENV CUDA_PKG_VERSION 10-1=$CUDA_VERSION-1
|
||||||
|
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}
|
||||||
|
ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64
|
||||||
|
|
||||||
|
ENV NVIDIA_VISIBLE_DEVICES all
|
||||||
|
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
|
||||||
|
ENV NVIDIA_REQUIRE_CUDA "cuda>=10.1 brand=tesla,driver>=396,driver<397 brand=tesla,driver>=410,driver<411 brand=tesla,driver>=418,driver<419"
|
||||||
|
ENV CUDNN_VERSION 7.6.5.32
|
||||||
|
ENV NCCL_VERSION 2.7.8
|
||||||
|
|
||||||
|
LABEL com.nvidia.cuda.version="${CUDA_VERSION}"
|
||||||
|
LABEL com.nvidia.cudnn.version="${CUDNN_VERSION}"
|
||||||
|
LABEL com.nvidia.volumes.needed="nvidia_driver"
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
gnupg2 \
|
||||||
|
curl \
|
||||||
|
ca-certificates \
|
||||||
|
&& curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub | apt-key add - \
|
||||||
|
&& echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list \
|
||||||
|
&& echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list \
|
||||||
|
&& apt-get purge --autoremove -y curl \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
cuda-cudart-$CUDA_PKG_VERSION \
|
||||||
|
cuda-compat-10-1 \
|
||||||
|
&& ln -s cuda-10.1 /usr/local/cuda \
|
||||||
|
&& echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf \
|
||||||
|
&& echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
cuda-libraries-$CUDA_PKG_VERSION \
|
||||||
|
cuda-npp-$CUDA_PKG_VERSION \
|
||||||
|
cuda-nvtx-$CUDA_PKG_VERSION \
|
||||||
|
libcublas10=10.2.1.243-1 \
|
||||||
|
libcudnn7=$CUDNN_VERSION-1+cuda10.1 \
|
||||||
|
libnccl2=$NCCL_VERSION-1+cuda10.1 \
|
||||||
|
&& apt-mark hold libnccl2 \
|
||||||
|
&& apt-mark hold libcudnn7 \
|
||||||
|
&& apt-mark hold libcublas10 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
importlib_resources; python_version<'3.7'
|
|
||||||
requests
|
|
||||||
setuptools>=41.0.0
|
|
||||||
pandas==0.25.1
|
|
||||||
tensorflow==1.15.2
|
|
||||||
ffmpeg-python
|
|
||||||
norbert==0.2.1
|
|
||||||
librosa==0.7.2
|
|
||||||
numba==0.48.0
|
|
||||||
4
setup.py
4
setup.py
@@ -8,7 +8,7 @@ import sys
|
|||||||
from os import path
|
from os import path
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ setup(
|
|||||||
long_description=readme,
|
long_description=readme,
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
author='Deezer Research',
|
author='Deezer Research',
|
||||||
author_email='research@deezer.com',
|
author_email='spleeter@deezer.com',
|
||||||
url='https://github.com/deezer/spleeter',
|
url='https://github.com/deezer/spleeter',
|
||||||
license='MIT License',
|
license='MIT License',
|
||||||
packages=[
|
packages=[
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
by providing train, evaluation and source separation action.
|
by providing train, evaluation and source separation action.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from .utils.logging import (
|
|||||||
enable_tensorflow_logging,
|
enable_tensorflow_logging,
|
||||||
get_logger)
|
get_logger)
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,6 @@
|
|||||||
- Waveform convertion and transforming functions.
|
- Waveform convertion and transforming functions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ from tensorflow.signal import stft, hann_window
|
|||||||
from .. import SpleeterError
|
from .. import SpleeterError
|
||||||
from ..utils.logging import get_logger
|
from ..utils.logging import get_logger
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import tensorflow as tf
|
|||||||
|
|
||||||
from ..utils.tensor import from_float32_to_uint8, from_uint8_to_float32
|
from ..utils.tensor import from_float32_to_uint8, from_uint8_to_float32
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from .adapter import AudioAdapter
|
|||||||
from .. import SpleeterError
|
from .. import SpleeterError
|
||||||
from ..utils.logging import get_logger
|
from ..utils.logging import get_logger
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import tensorflow as tf
|
|||||||
from tensorflow.signal import stft, hann_window
|
from tensorflow.signal import stft, hann_window
|
||||||
# pylint: enable=import-error
|
# pylint: enable=import-error
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from argparse import ArgumentParser
|
|||||||
from tempfile import gettempdir
|
from tempfile import gettempdir
|
||||||
from os.path import exists, join
|
from os.path import exists, join
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
@@ -170,6 +170,7 @@ def _create_evaluate_parser(parser_factory):
|
|||||||
parser.add_argument('-o', '--output_path', **OPT_OUTPUT)
|
parser.add_argument('-o', '--output_path', **OPT_OUTPUT)
|
||||||
parser.add_argument('--mus_dir', **OPT_MUSDB)
|
parser.add_argument('--mus_dir', **OPT_MUSDB)
|
||||||
parser.add_argument('-m', '--mwf', **OPT_MWF)
|
parser.add_argument('-m', '--mwf', **OPT_MWF)
|
||||||
|
parser.add_argument('-B', '--stft-backend', **OPT_STFT_BACKEND)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ except ImportError:
|
|||||||
logger.error('Please install musdb and museval first, abort')
|
logger.error('Please install musdb and museval first, abort')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ def _separate_evaluation_dataset(arguments, musdb_root_directory, params):
|
|||||||
bitrate='128k',
|
bitrate='128k',
|
||||||
MWF=arguments.MWF,
|
MWF=arguments.MWF,
|
||||||
verbose=arguments.verbose,
|
verbose=arguments.verbose,
|
||||||
stft_backend="auto"),
|
stft_backend=arguments.stft_backend),
|
||||||
params)
|
params)
|
||||||
return audio_output_directory
|
return audio_output_directory
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
from ..audio.adapter import get_audio_adapter
|
from ..audio.adapter import get_audio_adapter
|
||||||
from ..separator import Separator
|
from ..separator import Separator
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ from ..model import model_fn
|
|||||||
from ..model.provider import ModelProvider
|
from ..model.provider import ModelProvider
|
||||||
from ..utils.logging import get_logger
|
from ..utils.logging import get_logger
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ from .utils.tensor import (
|
|||||||
set_tensor_shape,
|
set_tensor_shape,
|
||||||
sync_apply)
|
sync_apply)
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from tensorflow.signal import stft, inverse_stft, hann_window
|
|||||||
|
|
||||||
from ..utils.tensor import pad_and_partition, pad_and_reshape
|
from ..utils.tensor import pad_and_partition, pad_and_reshape
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
@@ -275,9 +275,16 @@ class EstimatorSpecBuilder(object):
|
|||||||
spec_name = self.spectrogram_name
|
spec_name = self.spectrogram_name
|
||||||
|
|
||||||
if stft_name not in self._features:
|
if stft_name not in self._features:
|
||||||
|
# pad input with a frame of zeros
|
||||||
|
waveform = tf.concat([
|
||||||
|
tf.zeros((self._frame_length, self._n_channels)),
|
||||||
|
self._features['waveform']
|
||||||
|
],
|
||||||
|
0
|
||||||
|
)
|
||||||
stft_feature = tf.transpose(
|
stft_feature = tf.transpose(
|
||||||
stft(
|
stft(
|
||||||
tf.transpose(self._features['waveform']),
|
tf.transpose(waveform),
|
||||||
self._frame_length,
|
self._frame_length,
|
||||||
self._frame_step,
|
self._frame_step,
|
||||||
window_fn=lambda frame_length, dtype: (
|
window_fn=lambda frame_length, dtype: (
|
||||||
@@ -341,7 +348,7 @@ class EstimatorSpecBuilder(object):
|
|||||||
reshaped = tf.transpose(inversed)
|
reshaped = tf.transpose(inversed)
|
||||||
if time_crop is None:
|
if time_crop is None:
|
||||||
time_crop = tf.shape(self._features['waveform'])[0]
|
time_crop = tf.shape(self._features['waveform'])[0]
|
||||||
return reshaped[:time_crop, :]
|
return reshaped[self._frame_length:self._frame_length+time_crop, :]
|
||||||
|
|
||||||
def _build_mwf_output_waveform(self):
|
def _build_mwf_output_waveform(self):
|
||||||
""" Perform separation with multichannel Wiener Filtering using Norbert.
|
""" Perform separation with multichannel Wiener Filtering using Norbert.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
""" This package provide model functions. """
|
""" This package provide model functions. """
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ from tensorflow.keras.layers import (
|
|||||||
|
|
||||||
from . import apply
|
from . import apply
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from tensorflow.compat.v1.keras.initializers import he_uniform
|
|||||||
|
|
||||||
from . import apply
|
from . import apply
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from abc import ABC, abstractmethod
|
|||||||
from os import environ, makedirs
|
from os import environ, makedirs
|
||||||
from os.path import exists, isabs, join, sep
|
from os.path import exists, isabs, join, sep
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import requests
|
|||||||
from . import ModelProvider
|
from . import ModelProvider
|
||||||
from ...utils.logging import get_logger
|
from ...utils.logging import get_logger
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
""" Packages that provides static resources file for the library. """
|
""" Packages that provides static resources file for the library. """
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ from .utils.estimator import create_estimator, get_default_model_dir
|
|||||||
from .model import EstimatorSpecBuilder, InputProviderFactory
|
from .model import EstimatorSpecBuilder, InputProviderFactory
|
||||||
|
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
@@ -163,14 +163,18 @@ class Separator(object):
|
|||||||
data = np.asfortranarray(data)
|
data = np.asfortranarray(data)
|
||||||
N = self._params["frame_length"]
|
N = self._params["frame_length"]
|
||||||
H = self._params["frame_step"]
|
H = self._params["frame_step"]
|
||||||
|
|
||||||
win = hann(N, sym=False)
|
win = hann(N, sym=False)
|
||||||
fstft = istft if inverse else stft
|
fstft = istft if inverse else stft
|
||||||
win_len_arg = {"win_length": None, "length": length} if inverse else {"n_fft": N}
|
win_len_arg = {"win_length": None,
|
||||||
|
"length": None} if inverse else {"n_fft": N}
|
||||||
n_channels = data.shape[-1]
|
n_channels = data.shape[-1]
|
||||||
out = []
|
out = []
|
||||||
for c in range(n_channels):
|
for c in range(n_channels):
|
||||||
d = data[:, :, c].T if inverse else data[:, c]
|
d = np.concatenate((np.zeros((N, )), data[:, c], np.zeros((N, )))) if not inverse else data[:, :, c].T
|
||||||
s = fstft(d, hop_length=H, window=win, center=False, **win_len_arg)
|
s = fstft(d, hop_length=H, window=win, center=False, **win_len_arg)
|
||||||
|
if inverse:
|
||||||
|
s = s[N:N+length]
|
||||||
s = np.expand_dims(s.T, 2-inverse)
|
s = np.expand_dims(s.T, 2-inverse)
|
||||||
out.append(s)
|
out.append(s)
|
||||||
if len(out) == 1:
|
if len(out) == 1:
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
""" This package provides utility function and classes. """
|
""" This package provides utility function and classes. """
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from os.path import exists
|
|||||||
from .. import resources, SpleeterError
|
from .. import resources, SpleeterError
|
||||||
|
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import logging
|
|||||||
|
|
||||||
from os import environ
|
from os import environ
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import tensorflow as tf
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
# pylint: enable=import-error
|
# pylint: enable=import-error
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
""" Unit testing package. """
|
""" Unit testing package. """
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
""" Unit testing for Separator class. """
|
""" Unit testing for Separator class. """
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
@@ -25,33 +25,36 @@ from spleeter.commands import evaluate
|
|||||||
|
|
||||||
from spleeter.utils.configuration import load_configuration
|
from spleeter.utils.configuration import load_configuration
|
||||||
|
|
||||||
res_4stems = { "vocals": {
|
BACKENDS = ["tensorflow", "librosa"]
|
||||||
"SDR": -0.007,
|
TEST_CONFIGURATIONS = {el:el for el in BACKENDS}
|
||||||
"SAR": -19.231,
|
|
||||||
"SIR": -4.528,
|
res_4stems = {
|
||||||
"ISR": 0.000
|
"vocals": {
|
||||||
|
"SDR": 3.25e-05,
|
||||||
|
"SAR": -11.153575,
|
||||||
|
"SIR": -1.3849,
|
||||||
|
"ISR": 2.75e-05
|
||||||
},
|
},
|
||||||
"drums": {
|
"drums": {
|
||||||
"SDR": -0.071,
|
"SDR": -0.079505,
|
||||||
"SAR": -14.496,
|
"SAR": -15.7073575,
|
||||||
"SIR": -4.987,
|
"SIR": -4.972755,
|
||||||
"ISR": 0.001
|
"ISR": 0.0013575
|
||||||
},
|
},
|
||||||
"bass":{
|
"bass":{
|
||||||
"SDR": -0.001,
|
"SDR": 2.5e-06,
|
||||||
"SAR": -12.426,
|
"SAR": -10.3520575,
|
||||||
"SIR": -7.198,
|
"SIR": -4.272325,
|
||||||
"ISR": -0.001
|
"ISR": 2.5e-06
|
||||||
},
|
},
|
||||||
"other":{
|
"other":{
|
||||||
"SDR": -1.453,
|
"SDR": -1.359175,
|
||||||
"SAR": -14.899,
|
"SAR": -14.7076775,
|
||||||
"SIR": -4.678,
|
"SIR": -4.761505,
|
||||||
"ISR": -0.015
|
"ISR": -0.01528
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def generate_fake_eval_dataset(path):
|
def generate_fake_eval_dataset(path):
|
||||||
"""
|
"""
|
||||||
generate fake evaluation dataset
|
generate fake evaluation dataset
|
||||||
@@ -71,26 +74,15 @@ def generate_fake_eval_dataset(path):
|
|||||||
aa.save(filename, data, fs)
|
aa.save(filename, data, fs)
|
||||||
|
|
||||||
|
|
||||||
def test_evaluate():
|
|
||||||
"""
|
|
||||||
test evaluate command
|
|
||||||
"""
|
|
||||||
|
|
||||||
with TemporaryDirectory() as path:
|
@pytest.mark.parametrize('backend', TEST_CONFIGURATIONS)
|
||||||
|
def test_evaluate(backend):
|
||||||
# generate fake dataset
|
with TemporaryDirectory() as directory:
|
||||||
generate_fake_eval_dataset(path)
|
generate_fake_eval_dataset(directory)
|
||||||
|
|
||||||
# set up arguments of command
|
|
||||||
p = create_argument_parser()
|
p = create_argument_parser()
|
||||||
arguments = p.parse_args(["evaluate", "-p", "spleeter:4stems", "--mus_dir", path])
|
arguments = p.parse_args(["evaluate", "-p", "spleeter:4stems", "--mus_dir", directory, "-B", backend])
|
||||||
params = load_configuration(arguments.configuration)
|
params = load_configuration(arguments.configuration)
|
||||||
|
|
||||||
# run evaluation
|
|
||||||
metrics = evaluate.entrypoint(arguments, params)
|
metrics = evaluate.entrypoint(arguments, params)
|
||||||
|
|
||||||
# assert that the metric as not changed compared to reference value
|
|
||||||
# (Note that this fails with tensorflow backend)
|
|
||||||
for instrument, metric in metrics.items():
|
for instrument, metric in metrics.items():
|
||||||
for metric, value in metric.items():
|
for m, value in metric.items():
|
||||||
assert np.allclose(np.median(value), res_4stems[instrument][metric], atol=1e-3)
|
assert np.allclose(np.median(value), res_4stems[instrument][m], atol=1e-3)
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
""" Unit testing for audio adapter. """
|
""" Unit testing for audio adapter. """
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
""" Unit testing for Separator class. """
|
""" Unit testing for Separator class. """
|
||||||
|
|
||||||
__email__ = 'research@deezer.com'
|
__email__ = 'spleeter@deezer.com'
|
||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
@@ -39,13 +39,36 @@ TEST_CONFIGURATIONS = list(itertools.product(TEST_AUDIO_DESCRIPTORS, MODELS, BAC
|
|||||||
print("RUNNING TESTS WITH TF VERSION {}".format(tf.__version__))
|
print("RUNNING TESTS WITH TF VERSION {}".format(tf.__version__))
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('test_file', TEST_AUDIO_DESCRIPTORS)
|
||||||
|
def test_separator_backends(test_file):
|
||||||
|
adapter = get_default_audio_adapter()
|
||||||
|
waveform, _ = adapter.load(test_file)
|
||||||
|
|
||||||
|
separator_lib = Separator("spleeter:2stems", stft_backend="librosa")
|
||||||
|
separator_tf = Separator("spleeter:2stems", stft_backend="tensorflow")
|
||||||
|
|
||||||
|
# Test the stft and inverse stft provides exact reconstruction
|
||||||
|
stft_matrix = separator_lib._stft(waveform)
|
||||||
|
reconstructed = separator_lib._stft(
|
||||||
|
stft_matrix, inverse=True, length=waveform.shape[0])
|
||||||
|
assert np.allclose(reconstructed, waveform, atol=3e-2)
|
||||||
|
|
||||||
|
# compare both separation, it should be close
|
||||||
|
out_tf = separator_tf._separate_tensorflow(waveform, test_file)
|
||||||
|
out_lib = separator_lib._separate_librosa(waveform, test_file)
|
||||||
|
|
||||||
|
for instrument in out_lib.keys():
|
||||||
|
# test that both outputs are close everywhere
|
||||||
|
assert np.allclose(out_tf[instrument], out_lib[instrument], atol=1e-5)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('test_file, configuration, backend', TEST_CONFIGURATIONS)
|
@pytest.mark.parametrize('test_file, configuration, backend', TEST_CONFIGURATIONS)
|
||||||
def test_separate(test_file, configuration, backend):
|
def test_separate(test_file, configuration, backend):
|
||||||
""" Test separation from raw data. """
|
""" Test separation from raw data. """
|
||||||
instruments = MODEL_TO_INST[configuration]
|
instruments = MODEL_TO_INST[configuration]
|
||||||
adapter = get_default_audio_adapter()
|
adapter = get_default_audio_adapter()
|
||||||
waveform, _ = adapter.load(test_file)
|
waveform, _ = adapter.load(test_file)
|
||||||
separator = Separator(configuration, stft_backend=backend)
|
separator = Separator(configuration, stft_backend=backend, multiprocess=False)
|
||||||
prediction = separator.separate(waveform, test_file)
|
prediction = separator.separate(waveform, test_file)
|
||||||
assert len(prediction) == len(instruments)
|
assert len(prediction) == len(instruments)
|
||||||
for instrument in instruments:
|
for instrument in instruments:
|
||||||
@@ -63,7 +86,7 @@ def test_separate(test_file, configuration, backend):
|
|||||||
def test_separate_to_file(test_file, configuration, backend):
|
def test_separate_to_file(test_file, configuration, backend):
|
||||||
""" Test file based separation. """
|
""" Test file based separation. """
|
||||||
instruments = MODEL_TO_INST[configuration]
|
instruments = MODEL_TO_INST[configuration]
|
||||||
separator = Separator(configuration, stft_backend=backend)
|
separator = Separator(configuration, stft_backend=backend, multiprocess=False)
|
||||||
name = splitext(basename(test_file))[0]
|
name = splitext(basename(test_file))[0]
|
||||||
with TemporaryDirectory() as directory:
|
with TemporaryDirectory() as directory:
|
||||||
separator.separate_to_file(
|
separator.separate_to_file(
|
||||||
@@ -79,7 +102,7 @@ def test_separate_to_file(test_file, configuration, backend):
|
|||||||
def test_filename_format(test_file, configuration, backend):
|
def test_filename_format(test_file, configuration, backend):
|
||||||
""" Test custom filename format. """
|
""" Test custom filename format. """
|
||||||
instruments = MODEL_TO_INST[configuration]
|
instruments = MODEL_TO_INST[configuration]
|
||||||
separator = Separator(configuration, stft_backend=backend)
|
separator = Separator(configuration, stft_backend=backend, multiprocess=False)
|
||||||
name = splitext(basename(test_file))[0]
|
name = splitext(basename(test_file))[0]
|
||||||
with TemporaryDirectory() as directory:
|
with TemporaryDirectory() as directory:
|
||||||
separator.separate_to_file(
|
separator.separate_to_file(
|
||||||
@@ -95,7 +118,7 @@ def test_filename_format(test_file, configuration, backend):
|
|||||||
@pytest.mark.parametrize('test_file, configuration', MODELS_AND_TEST_FILES)
|
@pytest.mark.parametrize('test_file, configuration', MODELS_AND_TEST_FILES)
|
||||||
def test_filename_conflict(test_file, configuration):
|
def test_filename_conflict(test_file, configuration):
|
||||||
""" Test error handling with static pattern. """
|
""" Test error handling with static pattern. """
|
||||||
separator = Separator(configuration)
|
separator = Separator(configuration, multiprocess=False)
|
||||||
with TemporaryDirectory() as directory:
|
with TemporaryDirectory() as directory:
|
||||||
with pytest.raises(SpleeterError):
|
with pytest.raises(SpleeterError):
|
||||||
separator.separate_to_file(
|
separator.separate_to_file(
|
||||||
|
|||||||
Reference in New Issue
Block a user