From 94eb0e1ee55bb3e827670066e08b4eff601bee99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Voituret?= Date: Thu, 21 Nov 2019 17:48:46 +0100 Subject: [PATCH] fix: gpu distribution --- .circleci/config.yml | 39 ++++++++++++++++++++++++++++++++++++++- Makefile | 11 +++++++++-- setup.py | 13 ------------- 3 files changed, 47 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f4d6f08..0c8ab1c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,6 +49,16 @@ jobs: 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. # ======================================================================================= @@ -64,7 +74,20 @@ jobs: # TODO: Infer destination regarding of branch. # - master => production PyPi # - other => testing PyPi - command: make deploy + 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. # ======================================================================================= @@ -102,6 +125,8 @@ jobs: - run: docker push researchdeezer/spleeter:conda-gpu-2stems - run: docker push researchdeezer/spleeter:conda-gpu-4stems - run: docker push researchdeezer/spleeter:conda-gpu-5stems + - run: docker tag researchdeezer/spleeter:conda-gpu researchdeezer/spleeter:gpu + - run: docker push researchdeezer/spleeter:gpu docker-3.6-cpu: docker: - image: docker:17.05.0-ce-git @@ -152,6 +177,10 @@ workflows: requires: - test-3.6 - test-3.7 + - sdist-gpu: + requires: + - test-3.6 + - test-3.7 - pypi-deploy: filters: branches: @@ -159,10 +188,18 @@ workflows: - master requires: - sdist + - pypi-deploy-gpu: + filters: + branches: + only: + - master + requires: + - sdist - conda-forge-validation: type: approval requires: - pypi-deploy + - pypi-deploy-gpu filters: branches: only: diff --git a/Makefile b/Makefile index 33dce14..26380a2 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,14 @@ clean: rm -Rf *.egg-info rm -Rf dist -build: +build: clean + sed -i "s/project_name = ''/project_name = 'spleeter'/g" + sed -i "s/tensorflow_dependency = '[^']*'/tensorflow_dependency = 'tensorflow'/g" setup.py + python3 setup.py sdist + +build-gpu: clean + sed -i "s/project_name = ''/project_name = 'spleeter-gpu'/g" + sed -i "s/tensorflow_dependency = '[^']*'/tensorflow_dependency = 'tensorflow-gpu'/g" setup.py python3 setup.py sdist test: @@ -23,4 +30,4 @@ test: deploy: pip install twine - twine upload --skip-existing dist/* \ No newline at end of file + twine upload --skip-existing dist/* diff --git a/setup.py b/setup.py index c4665e6..12d85c0 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,6 @@ __license__ = 'MIT License' # Default project values. project_name = 'spleeter' project_version = '1.4.4' -device_target = 'cpu' tensorflow_dependency = 'tensorflow' tensorflow_version = '1.14.0' here = path.abspath(path.dirname(__file__)) @@ -23,18 +22,6 @@ readme_path = path.join(here, 'README.md') with open(readme_path, 'r') as stream: readme = stream.read() -# Check if GPU target is specified. -if '--target' in sys.argv: - target_index = sys.argv.index('--target') + 1 - target = sys.argv[target_index].lower() - sys.argv.remove('--target') - sys.argv.pop(target_index) - -# GPU target compatibility check. -if device_target == 'gpu': - project_name = '{}-gpu'.format(project_name) - tensorflow_dependency = 'tensorflow-gpu' - # Package setup entrypoint. setup( name=project_name,