diff --git a/.dockerignore b/.dockerignore index 255f49d..fbee7eb 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,3 @@ .env -.git \ No newline at end of file +.git +Dockerfile \ No newline at end of file diff --git a/.github/workflows/propose_release.yml b/.github/workflows/propose_release.yml new file mode 100644 index 0000000..81dfe43 --- /dev/null +++ b/.github/workflows/propose_release.yml @@ -0,0 +1,27 @@ +name: Propose Stable Release +on: + workflow_dispatch: + inputs: + release_type: + type: choice + description: Release Type + options: + - patch + - minor + - major +jobs: + update_version: + uses: neongeckocom/.github/.github/workflows/propose_semver_release.yml@master + with: + branch: dev + release_type: ${{ inputs.release_type }} + update_changelog: True + pull_changes: + uses: neongeckocom/.github/.github/workflows/pull_master.yml@master + needs: update_version + with: + pr_reviewer: neonreviewers + pr_assignee: ${{ github.actor }} + pr_draft: false + pr_title: ${{ needs.update_version.outputs.version }} + pr_body: ${{ needs.update_version.outputs.changelog }} \ No newline at end of file diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 41f0e79..290ee93 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -11,78 +11,10 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: - tag_release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Get Version - run: | - VERSION=$(python setup.py --version) - echo "VERSION=${VERSION}" >> $GITHUB_ENV - - uses: ncipollo/release-action@v1 - with: - token: ${{secrets.GITHUB_TOKEN}} - tag: ${{env.VERSION}} - build_and_publish_pypi: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install Build Tools - run: | - python -m pip install build wheel - - - name: Build Distribution Packages - run: | - python setup.py sdist bdist_wheel - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{secrets.PYPI_TOKEN}} + build_and_publish_pypi_and_release: + uses: neongeckocom/.github/.github/workflows/publish_stable_release.yml@master + secrets: inherit build_and_publish_docker: - runs-on: ubuntu-latest - needs: build_and_publish_pypi - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: ${{ github.ref }} - - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Get Version - id: version - run: | - VERSION=$(sed "s/a/-a./" <<< $(python setup.py --version)) - echo ::set-output name=version::${VERSION} - env: - image_name: ${{ env.IMAGE_NAME }} - - - name: Extract metadata for Docker - id: meta - uses: docker/metadata-action@v2 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=raw,value=latest - type=semver,pattern={{version}},value=${{ steps.version.outputs.version }} - - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + needs: build_and_publish_pypi_and_release + uses: neongeckocom/.github/.github/workflows/publish_docker.yml@master + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/publish_test_build.yml b/.github/workflows/publish_test_build.yml index ff7dc73..11b6088 100644 --- a/.github/workflows/publish_test_build.yml +++ b/.github/workflows/publish_test_build.yml @@ -13,74 +13,14 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: - build_and_publish_pypi: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: Increment Version - run: | - VER=$(python setup.py --version) - python version_bump.py - - name: Push Version Change - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Increment Version - - name: Build Distribution Packages - run: | - python setup.py sdist bdist_wheel - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{secrets.PYPI_TOKEN}} + publish_alpha_release: + uses: neongeckocom/.github/.github/workflows/publish_alpha_release.yml@master + secrets: inherit + with: + version_file: "version.py" + setup_py: "setup.py" + publish_prerelease: true build_and_publish_docker: - runs-on: ubuntu-latest - needs: build_and_publish_pypi - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: ${{ github.ref }} - - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Get Version - id: version - run: | - VERSION=$(sed "s/a/-a./" <<< $(python setup.py --version)) - echo ::set-output name=version::${VERSION} - env: - image_name: ${{ env.IMAGE_NAME }} - - - name: Extract metadata for Docker - id: meta - uses: docker/metadata-action@v2 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=semver,pattern={{version}},value=${{ steps.version.outputs.version }} - - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + needs: publish_alpha_release + uses: neongeckocom/.github/.github/workflows/publish_docker.yml@master + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/pull_master.yml b/.github/workflows/pull_master.yml deleted file mode 100644 index aae67da..0000000 --- a/.github/workflows/pull_master.yml +++ /dev/null @@ -1,21 +0,0 @@ -# This workflow will generate a PR for changes in cert into master - -name: Pull to Master -on: - push: - branches: - - dev - workflow_dispatch: - -jobs: - pull_changes: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: pull-request-action - uses: repo-sync/pull-request@v2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - pr_reviewer: 'neonreviewers' - pr_assignee: 'neondaniel' - pr_draft: true diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 09ab0ca..531cd31 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -6,26 +6,14 @@ on: workflow_dispatch: jobs: - build_tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: Build Distribution Packages - run: | - python setup.py sdist bdist_wheel + py_build_tests: + uses: neongeckocom/.github/.github/workflows/python_build_tests.yml@master + docker_build_tests: + uses: neongeckocom/.github/.github/workflows/docker_build_tests.yml@master unit_tests: strategy: matrix: - python-version: [ 3.7, 3.8, 3.9, "3.10" ] + python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f419195 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,48 @@ +# Changelog + +## [0.7.3a7](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/tree/0.7.3a7) (2024-02-23) + +[Full Changelog](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/compare/0.7.3a6...0.7.3a7) + +**Merged pull requests:** + +- Update Gradio Web UI [\#114](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/pull/114) ([NeonDaniel](https://github.com/NeonDaniel)) + +## [0.7.3a6](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/tree/0.7.3a6) (2024-02-23) + +[Full Changelog](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/compare/0.7.3a5...0.7.3a6) + +**Merged pull requests:** + +- Pin ovos-tts-server version for stable container release [\#113](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/pull/113) ([NeonDaniel](https://github.com/NeonDaniel)) + +## [0.7.3a5](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/tree/0.7.3a5) (2024-02-23) + +[Full Changelog](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/compare/0.7.2...0.7.3a5) + +**Implemented enhancements:** + +- \[FEAT\] Python3.11-Compatible PyTorch [\#109](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/issues/109) + +**Fixed bugs:** + +- \[BUG\] I get error message "KeyError: 'en-us'" when I use "CoquiTTS\(\)" [\#99](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/issues/99) +- Torch Compatibility [\#82](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/issues/82) + +**Closed issues:** + +- Tried to install Neon tts on Windows 11 using docker commands in PowerShell [\#105](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/issues/105) +- "TypeError: NoneType object is not callable" when starting ovos-tts-server [\#88](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/issues/88) + +**Merged pull requests:** + +- Update automation to publish GH prereleases [\#112](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/pull/112) ([NeonDaniel](https://github.com/NeonDaniel)) +- Fix relative paths in setup.py [\#111](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/pull/111) ([NeonDaniel](https://github.com/NeonDaniel)) +- Loosen dependency for Python 3.11 Compat. [\#110](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/pull/110) ([NeonDaniel](https://github.com/NeonDaniel)) +- Handle connection errors and fall back to local cached model files [\#108](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/pull/108) ([NeonDaniel](https://github.com/NeonDaniel)) +- Update release automation to new workflow [\#104](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/pull/104) ([NeonDaniel](https://github.com/NeonDaniel)) +- Update Docker to include Gradio web UI [\#102](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui/pull/102) ([NeonDaniel](https://github.com/NeonDaniel)) + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/Dockerfile b/Dockerfile index 0340136..8bb86f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,20 @@ -FROM python:3.9-slim-bullseye AS compile-image - -RUN apt-get update -y && apt-get install -y python3-pip git - -RUN pip3 install --user torch --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu +FROM python:3.9-slim AS compile-image COPY . /tmp/neon-tts-plugin-coqui -RUN pip3 install --user /tmp/neon-tts-plugin-coqui --no-cache-dir - -RUN pip3 install --user git+https://github.com/OpenVoiceOS/ovos-tts-server@b9ee84c48ab6ab5655fffa032359752ab10d2c9d +RUN pip install wheel && \ + pip install --user --no-cache-dir \ + /tmp/neon-tts-plugin-coqui/[docker] --extra-index-url https://download.pytorch.org/whl/cpu -FROM python:3.9-slim-bullseye AS build-image - -RUN apt-get update -y && apt-get install -y --no-install-recommends espeak-ng +# Copy built packages to a clean image to exclude build-time extras from final image +FROM python:3.9-slim AS build-image COPY --from=compile-image /root/.local /root/.local ENV PATH=/root/.local/bin:$PATH -ENTRYPOINT ovos-tts-server --engine coqui \ No newline at end of file +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + espeak-ng + +ENTRYPOINT ovos-tts-server --engine coqui --gradio \ +--title "πŸΈπŸ’¬ - Neon AI Coqui AI TTS Plugin" \ +--description "πŸΈπŸ’¬ - a deep learning toolkit for Text-to-Speech, battle-tested in research and production" \ +--info "more info at [Neon Coqui TTS Plugin](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui), [Coqui TTS](https://github.com/coqui-ai/TTS)" \ No newline at end of file diff --git a/neon_tts_plugin_coqui/__init__.py b/neon_tts_plugin_coqui/__init__.py index 898bdc8..ceac52c 100644 --- a/neon_tts_plugin_coqui/__init__.py +++ b/neon_tts_plugin_coqui/__init__.py @@ -254,7 +254,14 @@ def _download_huggingface(self, model_name) -> str: model_name, *suffix = model_name.split("@") revision = dict(enumerate(suffix)).get(0, None) - model_path = hf_hub_download(model_name, "model.pt", revision=revision) + try: + model_path = hf_hub_download(model_name, "model.pt", + revision=revision) + except ConnectionError as e: + LOG.error(e) + model_path = hf_hub_download(model_name, "model.pt", + revision=revision, + local_files_only=True) return model_path diff --git a/requirements/docker.txt b/requirements/docker.txt new file mode 100644 index 0000000..8d97811 --- /dev/null +++ b/requirements/docker.txt @@ -0,0 +1 @@ +ovos-tts-server==0.0.3a10 \ No newline at end of file diff --git a/requirements/requirements.txt b/requirements/requirements.txt index afecd60..2632e44 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,8 +1,9 @@ # TTS numpy>=1.19.5 -torch~=1.9,!=1.13.0 +torch>=1.9.0,<3.0.0,!=1.13.0 # dependencies -ovos-plugin-manager~=0.0.2 +ovos-plugin-manager~=0.0.23 +ovos-utils~=0.0.32 psutil # huggingface -huggingface-hub \ No newline at end of file +huggingface-hub diff --git a/setup.py b/setup.py index 0f1aeae..19c13d0 100644 --- a/setup.py +++ b/setup.py @@ -29,21 +29,26 @@ from setuptools import setup, find_packages from os import path, getenv +BASE_PATH = path.abspath(path.dirname(__file__)) + def get_requirements(requirements_filename: str): - requirements_file = path.join(path.abspath(path.dirname(__file__)), "requirements", requirements_filename) + requirements_file = path.join(BASE_PATH, "requirements", requirements_filename) with open(requirements_file, 'r', encoding='utf-8') as r: requirements = r.readlines() - requirements = [r.strip() for r in requirements if r.strip() and not r.strip().startswith("#")] + requirements = [r.strip() for r in requirements if r.strip() and not + r.strip().startswith("#")] for i in range(0, len(requirements)): r = requirements[i] if "@" in r: - parts = [p.lower() if p.strip().startswith("git+http") else p for p in r.split('@')] + parts = [p.lower() if p.strip().startswith("git+http") else p + for p in r.split('@')] r = "@".join(parts) if getenv("GITHUB_TOKEN"): if "github.com" in r: - r = r.replace("github.com", f"{getenv('GITHUB_TOKEN')}@github.com") + r = r.replace("github.com", + f"{getenv('GITHUB_TOKEN')}@github.com") requirements[i] = r return requirements @@ -51,10 +56,10 @@ def get_requirements(requirements_filename: str): PLUGIN_ENTRY_POINT = 'coqui = neon_tts_plugin_coqui:CoquiTTS' CONFIG_ENTRY_POINT = 'coqui.config = neon_tts_plugin_coqui.configs:tts_config' -with open("README.md", "r") as f: +with open(path.join(BASE_PATH, "README.md"), "r") as f: long_description = f.read() -with open("./version.py", "r", encoding="utf-8") as v: +with open(path.join(BASE_PATH, "version.py"), "r", encoding="utf-8") as v: for line in v.readlines(): if line.startswith("__version__"): if '"' in line: @@ -74,6 +79,7 @@ def get_requirements(requirements_filename: str): license='BSD-3.0', packages=find_packages(), install_requires=get_requirements("requirements.txt"), + extras_require={"docker": get_requirements("docker.txt")}, zip_safe=True, classifiers=[ 'Intended Audience :: Developers', diff --git a/version.py b/version.py index 27362a0..68b129c 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "0.7.2" +__version__ = "0.8.0"