From 9da27491d8492eba444081cb9cdfefddec44cf41 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:04:57 +0300 Subject: [PATCH 01/29] push to ghcr --- .github/workflows/build-and-push-to-ghcr.yml | 30 ++++++++++++++++++++ server/Dockerfile | 2 +- server/requirements.txt | 6 ++-- 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build-and-push-to-ghcr.yml diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml new file mode 100644 index 0000000..67973d1 --- /dev/null +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -0,0 +1,30 @@ +name: Build and push to GHCR +on: + push: + branches: + - 'main' +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: 'Login to GitHub Container Registry' + run: | + set -xe + docker login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io + + - name: Build and push + uses: docker/build-push-action@v5 + with: + file: server/Dockerfile + push: true + cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest + cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest + tags: coqui-ai/xtts-streaming-server:latest + #build-args: diff --git a/server/Dockerfile b/server/Dockerfile index ea97d9d..8305254 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,7 +1,7 @@ FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-devel WORKDIR /app COPY requirements.txt . -RUN python -m pip install -r requirements.txt --use-deprecated=legacy-resolver +RUN python -m pip install -r requirements.txt COPY main.py . diff --git a/server/requirements.txt b/server/requirements.txt index 4895c2e..3113993 100644 --- a/server/requirements.txt +++ b/server/requirements.txt @@ -1,6 +1,6 @@ -TTS==0.18.2 +TTS==0.19.1 uvicorn[standard]==0.23.2 -fastapi==0.104.0 -deepspeed==0.8.3 +fastapi==0.95.2 +deepspeed==0.10.3 pydantic==1.10.13 python-multipart==0.0.6 From 7f82fe2a55da28af875382c382accdddb75bb517 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:05:45 +0300 Subject: [PATCH 02/29] typing-extensions>=4.8.0, use legacy --- server/Dockerfile | 2 +- server/requirements.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/server/Dockerfile b/server/Dockerfile index 8305254..ea97d9d 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,7 +1,7 @@ FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-devel WORKDIR /app COPY requirements.txt . -RUN python -m pip install -r requirements.txt +RUN python -m pip install -r requirements.txt --use-deprecated=legacy-resolver COPY main.py . diff --git a/server/requirements.txt b/server/requirements.txt index 3113993..f2b2ac1 100644 --- a/server/requirements.txt +++ b/server/requirements.txt @@ -4,3 +4,4 @@ fastapi==0.95.2 deepspeed==0.10.3 pydantic==1.10.13 python-multipart==0.0.6 +typing-extensions>=4.8.0 From 0de2626eed2b10d938083a3891657a483a2c8b67 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:09:44 +0300 Subject: [PATCH 03/29] pr should try to build it too --- .github/workflows/build-and-push-to-ghcr.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index 67973d1..ba56229 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -1,12 +1,23 @@ name: Build and push to GHCR on: push: - branches: - - 'main' + branches: [main] + pull_request: +env: + GHCR_URL: ghcr.io/coqui-ai/xtts-streaming-server jobs: docker: runs-on: ubuntu-latest steps: + - name: Set Release version + shell: bash + run: | + if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then + echo "RELEASE_VERSION=dev" >> $GITHUB_ENV + else + echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + fi + export TAG=${GHCR_URL}:${{ env.RELEASE_VERSION }}-${{ github.sha }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -26,5 +37,5 @@ jobs: push: true cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest - tags: coqui-ai/xtts-streaming-server:latest + tags: coqui-ai/xtts-streaming-server:latest, $TAG #build-args: From c183844b498da9709eec8fbbfa52eed7f8797455 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:10:49 +0300 Subject: [PATCH 04/29] pr should try to build it too --- .github/workflows/build-and-push-to-ghcr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index ba56229..881b9be 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -6,7 +6,7 @@ on: env: GHCR_URL: ghcr.io/coqui-ai/xtts-streaming-server jobs: - docker: + build-and-push-to-ghcr: runs-on: ubuntu-latest steps: - name: Set Release version @@ -37,5 +37,5 @@ jobs: push: true cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest - tags: coqui-ai/xtts-streaming-server:latest, $TAG + tags: coqui-ai/xtts-streaming-server:latest, ${GHCR_URL}:${{ env.RELEASE_VERSION }}-${{ github.sha }} #build-args: From 4d48b9c4931ffb7b4da9a7827bc88889880ce467 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:11:43 +0300 Subject: [PATCH 05/29] pr should try to build it too --- .github/workflows/build-and-push-to-ghcr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index 881b9be..413e9e6 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -37,5 +37,5 @@ jobs: push: true cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest - tags: coqui-ai/xtts-streaming-server:latest, ${GHCR_URL}:${{ env.RELEASE_VERSION }}-${{ github.sha }} + tags: coqui-ai/xtts-streaming-server:latest, ${{ GHCR_URL }}:${{ env.RELEASE_VERSION }}-${{ github.sha }} #build-args: From ed7a886a36b69ceb690df3d1754b345e654aff5c Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:12:38 +0300 Subject: [PATCH 06/29] only push main builds --- .github/workflows/build-and-push-to-ghcr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index 413e9e6..da288d8 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -34,8 +34,8 @@ jobs: uses: docker/build-push-action@v5 with: file: server/Dockerfile - push: true + push: ${{ env.RELEASE_VERSION }}=="main" cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest - tags: coqui-ai/xtts-streaming-server:latest, ${{ GHCR_URL }}:${{ env.RELEASE_VERSION }}-${{ github.sha }} + tags: coqui-ai/xtts-streaming-server:latest #build-args: From eca923e8a6f6f8e421a33f234a3055f062b2e8a5 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:13:35 +0300 Subject: [PATCH 07/29] only push main builds --- .github/workflows/build-and-push-to-ghcr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index da288d8..6a78aad 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -34,7 +34,7 @@ jobs: uses: docker/build-push-action@v5 with: file: server/Dockerfile - push: ${{ env.RELEASE_VERSION }}=="main" + push: true if ${{ env.RELEASE_VERSION }}=="main" else false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest tags: coqui-ai/xtts-streaming-server:latest From f025f8f108a143e411ff2ed5d3d8a8f98faa8c9d Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:14:56 +0300 Subject: [PATCH 08/29] only push main builds --- .github/workflows/build-and-push-to-ghcr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index 6a78aad..4e8c991 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -34,7 +34,7 @@ jobs: uses: docker/build-push-action@v5 with: file: server/Dockerfile - push: true if ${{ env.RELEASE_VERSION }}=="main" else false + push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest tags: coqui-ai/xtts-streaming-server:latest From 0e0b07738e7ba9334de7f75ac7643f03026d3c05 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:18:43 +0300 Subject: [PATCH 09/29] only push main builds --- .github/workflows/build-and-push-to-ghcr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index 4e8c991..84875a1 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -7,7 +7,7 @@ env: GHCR_URL: ghcr.io/coqui-ai/xtts-streaming-server jobs: build-and-push-to-ghcr: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Set Release version shell: bash @@ -33,7 +33,7 @@ jobs: - name: Build and push uses: docker/build-push-action@v5 with: - file: server/Dockerfile + file: ./server/Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest From 91972c66db5c8296807f75ca85f4a9ed40f4691d Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:21:00 +0300 Subject: [PATCH 10/29] only push main builds --- .github/workflows/build-and-push-to-ghcr.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index 84875a1..c600600 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -30,7 +30,8 @@ jobs: set -xe docker login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io - - name: Build and push + - name: Build only for PR + if: github.ref != 'refs/heads/main' uses: docker/build-push-action@v5 with: file: ./server/Dockerfile @@ -39,3 +40,15 @@ jobs: cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest tags: coqui-ai/xtts-streaming-server:latest #build-args: + + - name: Build and Push image + if: github.ref == 'refs/heads/main' + uses: docker/build-push-action@v5 + with: + file: server/Dockerfile + push: false + cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest + cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest + tags: coqui-ai/xtts-streaming-server:latest + #build-args: + From 254bdd4b50c0bdec03faf057430be8a270039694 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:24:10 +0300 Subject: [PATCH 11/29] use workdir --- .github/workflows/build-and-push-to-ghcr.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index c600600..d1c73e1 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -33,8 +33,9 @@ jobs: - name: Build only for PR if: github.ref != 'refs/heads/main' uses: docker/build-push-action@v5 + working-directory: ./server with: - file: ./server/Dockerfile + file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest @@ -44,8 +45,9 @@ jobs: - name: Build and Push image if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v5 + working-directory: ./server with: - file: server/Dockerfile + file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest From 9ac25f8207eb46635a9970746b212fd8a2533e0b Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:25:01 +0300 Subject: [PATCH 12/29] use workdir --- .github/workflows/build-and-push-to-ghcr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index d1c73e1..4b9c238 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -33,8 +33,8 @@ jobs: - name: Build only for PR if: github.ref != 'refs/heads/main' uses: docker/build-push-action@v5 - working-directory: ./server with: + working-directory: ./server file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest @@ -45,8 +45,8 @@ jobs: - name: Build and Push image if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v5 - working-directory: ./server with: + working-directory: ./server file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest From 7ff46733597fc92e69172611428f126c89d7a6e0 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:26:25 +0300 Subject: [PATCH 13/29] use workdir --- .github/workflows/build-and-push-to-ghcr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index 4b9c238..f3abbbe 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -34,7 +34,7 @@ jobs: if: github.ref != 'refs/heads/main' uses: docker/build-push-action@v5 with: - working-directory: ./server + context: ./server file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest @@ -46,7 +46,7 @@ jobs: if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v5 with: - working-directory: ./server + context: ./server file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest From ca43243fc4c40734021ae2ed05bf0f2c1ff2d31e Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:27:02 +0300 Subject: [PATCH 14/29] use workdir --- .github/workflows/build-and-push-to-ghcr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index f3abbbe..cc7a62b 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -34,7 +34,7 @@ jobs: if: github.ref != 'refs/heads/main' uses: docker/build-push-action@v5 with: - context: ./server + context: server file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest @@ -46,7 +46,7 @@ jobs: if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v5 with: - context: ./server + context: server file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest From 8cfe661fd4bc9cb1aacf6cd6eea0bb823ec7a948 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:29:51 +0300 Subject: [PATCH 15/29] use workdir --- .github/workflows/build-and-push-to-ghcr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index cc7a62b..2977b04 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -34,7 +34,7 @@ jobs: if: github.ref != 'refs/heads/main' uses: docker/build-push-action@v5 with: - context: server + context: "{{defaultContext}}:server" file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest @@ -46,7 +46,7 @@ jobs: if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v5 with: - context: server + context: "{{defaultContext}}:server" file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest From 80417fa2de14c1c98788fd56bd06d12760cba801 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:31:04 +0300 Subject: [PATCH 16/29] use workdir --- .github/workflows/build-and-push-to-ghcr.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index 2977b04..ba4b817 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -9,6 +9,10 @@ jobs: build-and-push-to-ghcr: runs-on: ubuntu-22.04 steps: + - + name: Checkout + uses: actions/checkout@v3 + - name: Set Release version shell: bash run: | @@ -34,7 +38,7 @@ jobs: if: github.ref != 'refs/heads/main' uses: docker/build-push-action@v5 with: - context: "{{defaultContext}}:server" + context: server #directory file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest @@ -46,7 +50,7 @@ jobs: if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v5 with: - context: "{{defaultContext}}:server" + context: server #directory file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest From b7f217f2fb696b2c2e5042b02fa1c12a8b2f185d Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:32:07 +0300 Subject: [PATCH 17/29] use workdir --- .github/workflows/build-and-push-to-ghcr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index ba4b817..0b922ca 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -38,7 +38,7 @@ jobs: if: github.ref != 'refs/heads/main' uses: docker/build-push-action@v5 with: - context: server #directory + context: "{{defaultContext}}:server" file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest @@ -50,7 +50,7 @@ jobs: if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v5 with: - context: server #directory + context: "{{defaultContext}}:server" file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest From 0e4ab43e5d5dd7e27a24d0b4d101e811fc1ca64d Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:38:12 +0300 Subject: [PATCH 18/29] use workdir --- .github/workflows/build-and-push-to-ghcr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index 0b922ca..d186d53 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -55,6 +55,6 @@ jobs: push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest - tags: coqui-ai/xtts-streaming-server:latest + tags: coqui-ai/xtts-streaming-server:latest, coqui-ai/xtts-streaming-server:${{ env.RELEASE_VERSION }}-${{ github.sha }} #build-args: From 996ea36cfd76153c3702743e06f218983675fd8b Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:41:12 +0300 Subject: [PATCH 19/29] fixes for comments --- .github/workflows/build-and-push-to-ghcr.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index d186d53..bdb001d 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -22,9 +22,6 @@ jobs: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV fi export TAG=${GHCR_URL}:${{ env.RELEASE_VERSION }}-${{ github.sha }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -41,8 +38,8 @@ jobs: context: "{{defaultContext}}:server" file: Dockerfile push: false - cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest - cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest + cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache + cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache tags: coqui-ai/xtts-streaming-server:latest #build-args: From a90c1a83a4a61ba1819a8c3540003eea5d6fd4b7 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:43:47 +0300 Subject: [PATCH 20/29] fixes main build cache ref pr will use cache but will not update --- .github/workflows/build-and-push-to-ghcr.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index bdb001d..abaf149 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -39,8 +39,7 @@ jobs: file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache - cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache - tags: coqui-ai/xtts-streaming-server:latest + tags: coqui-ai/xtts-streaming-server:${{ env.RELEASE_VERSION }}-${{ github.sha }} #build-args: - name: Build and Push image @@ -50,8 +49,8 @@ jobs: context: "{{defaultContext}}:server" file: Dockerfile push: false - cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest - cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest + cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache + cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache tags: coqui-ai/xtts-streaming-server:latest, coqui-ai/xtts-streaming-server:${{ env.RELEASE_VERSION }}-${{ github.sha }} #build-args: From 8dfdbd6870a3d70d059be4b0594739cfd66db957 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:53:20 +0300 Subject: [PATCH 21/29] add some logs --- .github/workflows/build-and-push-to-ghcr.yml | 1 + server/main.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index abaf149..2ebb585 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -39,6 +39,7 @@ jobs: file: Dockerfile push: false cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache + cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache tags: coqui-ai/xtts-streaming-server:${{ env.RELEASE_VERSION }}-${{ github.sha }} #build-args: diff --git a/server/main.py b/server/main.py index 56bd94d..9f9cac8 100644 --- a/server/main.py +++ b/server/main.py @@ -22,14 +22,18 @@ device = torch.device("cuda") model_name = "tts_models/multilingual/multi-dataset/xtts_v1.1" +print("Downloading XTTS Model:",model_name) ModelManager().download_model(model_name) model_path = os.path.join(get_user_data_dir("tts"), model_name.replace("/", "--")) +print("XTTS Model downloaded") +print("Loading XTTS") config = XttsConfig() config.load_json(os.path.join(model_path, "config.json")) model = Xtts.init_from_config(config) model.load_checkpoint(config, checkpoint_dir=model_path, eval=True, use_deepspeed=True) model.to(device) +print("XTTS Loaded.") ##### Run fastapi ##### app = FastAPI( From 41384d5cf7fcabaa73760834c39d5b177dff98ed Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 14:55:30 +0300 Subject: [PATCH 22/29] use numpy 1.24.3 (works locally) --- server/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/server/requirements.txt b/server/requirements.txt index f2b2ac1..8a3ad11 100644 --- a/server/requirements.txt +++ b/server/requirements.txt @@ -5,3 +5,4 @@ deepspeed==0.10.3 pydantic==1.10.13 python-multipart==0.0.6 typing-extensions>=4.8.0 +numpy==1.24.3 \ No newline at end of file From 5e3fb8d6163e0758b99cfe39bcfc725939cac436 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 15:09:47 +0300 Subject: [PATCH 23/29] pr caching --- .github/workflows/build-and-push-to-ghcr.yml | 21 ++++++-------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index 2ebb585..bb143b1 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -13,15 +13,6 @@ jobs: name: Checkout uses: actions/checkout@v3 - - name: Set Release version - shell: bash - run: | - if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then - echo "RELEASE_VERSION=dev" >> $GITHUB_ENV - else - echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - fi - export TAG=${GHCR_URL}:${{ env.RELEASE_VERSION }}-${{ github.sha }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -37,9 +28,9 @@ jobs: with: context: "{{defaultContext}}:server" file: Dockerfile - push: false - cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache - cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache + push: false # Do not push image for PR + cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.pull_request.head.sha }} + cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.pull_request.head.sha }} tags: coqui-ai/xtts-streaming-server:${{ env.RELEASE_VERSION }}-${{ github.sha }} #build-args: @@ -49,9 +40,9 @@ jobs: with: context: "{{defaultContext}}:server" file: Dockerfile - push: false - cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache - cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache + push: true # Push if merged + cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest + cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest tags: coqui-ai/xtts-streaming-server:latest, coqui-ai/xtts-streaming-server:${{ env.RELEASE_VERSION }}-${{ github.sha }} #build-args: From efff6a6140338684d9eef0c9f51fcce2528c15e3 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 15:12:02 +0300 Subject: [PATCH 24/29] pr caching --- .github/workflows/build-and-push-to-ghcr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index bb143b1..317aabb 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -31,7 +31,7 @@ jobs: push: false # Do not push image for PR cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.pull_request.head.sha }} cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.pull_request.head.sha }} - tags: coqui-ai/xtts-streaming-server:${{ env.RELEASE_VERSION }}-${{ github.sha }} + tags: coqui-ai/xtts-streaming-server:pr-${{ github.event.pull_request.head.sha }} #build-args: - name: Build and Push image From 7b7fee228303a87e1077624f29dd64373bdcc848 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 15:16:49 +0300 Subject: [PATCH 25/29] pr number as cache, remove tags on pr --- .github/workflows/build-and-push-to-ghcr.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index 317aabb..f78374a 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -29,10 +29,8 @@ jobs: context: "{{defaultContext}}:server" file: Dockerfile push: false # Do not push image for PR - cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.pull_request.head.sha }} - cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.pull_request.head.sha }} - tags: coqui-ai/xtts-streaming-server:pr-${{ github.event.pull_request.head.sha }} - #build-args: + cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.number }} + cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.number }} - name: Build and Push image if: github.ref == 'refs/heads/main' From 53e18e75bb8851b2fdd4c8bb43fb8796abea73ce Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 15:30:29 +0300 Subject: [PATCH 26/29] multiple cache --- .github/workflows/build-and-push-to-ghcr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index f78374a..afbc9ec 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -29,7 +29,7 @@ jobs: context: "{{defaultContext}}:server" file: Dockerfile push: false # Do not push image for PR - cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.number }} + cache-from: "type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest","type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.number }}" cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.number }} - name: Build and Push image From baa491c5fd000081685a977e615c85ce964a2dbb Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 15:30:36 +0300 Subject: [PATCH 27/29] multiple cache --- .github/workflows/build-and-push-to-ghcr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index afbc9ec..a95f9be 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -29,7 +29,8 @@ jobs: context: "{{defaultContext}}:server" file: Dockerfile push: false # Do not push image for PR - cache-from: "type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest","type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.number }}" + cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest + cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.number }} cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.number }} - name: Build and Push image From 953b4043d49e40689ffe8038fc3aa8c6ec0ff7b0 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 15:39:54 +0300 Subject: [PATCH 28/29] multiple cache --- .github/workflows/build-and-push-to-ghcr.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index a95f9be..02e3835 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -29,8 +29,7 @@ jobs: context: "{{defaultContext}}:server" file: Dockerfile push: false # Do not push image for PR - cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest - cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.number }} + cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest;type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.number }} cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.number }} - name: Build and Push image From 84cc96b7f5318e02057daa1956847512bfab298d Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 15:41:44 +0300 Subject: [PATCH 29/29] NUM_THREADS env var --- server/Dockerfile | 1 + server/main.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/server/Dockerfile b/server/Dockerfile index ea97d9d..422ff53 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -5,5 +5,6 @@ RUN python -m pip install -r requirements.txt --use-deprecated=legacy-resolver COPY main.py . +ENV NUM_THREADS=8 EXPOSE 80 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"] diff --git a/server/main.py b/server/main.py index 9f9cac8..f293728 100644 --- a/server/main.py +++ b/server/main.py @@ -18,7 +18,7 @@ from TTS.utils.generic_utils import get_user_data_dir from TTS.utils.manage import ModelManager -torch.set_num_threads(8) +torch.set_num_threads(int(os.environ.get("NUM_THREADS", "8"))) device = torch.device("cuda") model_name = "tts_models/multilingual/multi-dataset/xtts_v1.1"