Skip to content

Commit

Permalink
cuda 12.1 build (for newer gpus) (#4)
Browse files Browse the repository at this point in the history
* cuda 12.1 build (for newer gpus)

* seperate jobs

* seperate jobs

* cuda 12.1 use develepment (need nvcc for deepspeed)

* remove cache for build space
  • Loading branch information
gorkemgoknar authored Oct 30, 2023
1 parent 634e257 commit de53a25
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 4 deletions.
86 changes: 82 additions & 4 deletions .github/workflows/build-and-push-to-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches: [main]
pull_request:
jobs:
build-and-push-to-ghcr:
build-and-push-to-ghcr-cuda117:
runs-on: ubuntu-22.04
steps:
-
Expand All @@ -20,17 +20,24 @@ jobs:
set -xe
docker login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io
- name: Build only for PR
- name: 'Remove cache'
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Build only for PR Cuda 11.7
if: github.ref != 'refs/heads/main'
uses: docker/build-push-action@v5
with:
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; 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
- name: Build and Push image Cuda 11.7
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
Expand All @@ -42,13 +49,39 @@ jobs:
tags: ghcr.io/coqui-ai/xtts-streaming-server:latest, ghcr.io/coqui-ai/xtts-streaming-server:main-${{ github.sha }}
#build-args:

build-and-push-to-ghcr-cuda118:
runs-on: ubuntu-22.04
steps:
-
name: Checkout
uses: actions/checkout@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: 'Remove cache'
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Build only for PR cuda 11.8
if: github.ref != 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:server"
file: Dockerfile.cuda118
push: false # Do not push image for PR
cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest-cuda118; type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-cuda118-${{ github.event.number }}
cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-cuda118-${{ github.event.number }}

- name: Build and Push image cuda 11.8
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
Expand All @@ -60,3 +93,48 @@ jobs:
cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest-cuda118
tags: ghcr.io/coqui-ai/xtts-streaming-server:latest-cuda118, ghcr.io/coqui-ai/xtts-streaming-server:main-cuda118-${{ github.sha }}
#build-args:

build-and-push-to-ghcr-cuda121:
runs-on: ubuntu-22.04
steps:
-
name: Checkout
uses: actions/checkout@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: 'Remove cache'
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Build only for PR cuda 12.1
if: github.ref != 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:server"
file: Dockerfile.cuda121
push: false # Do not push image for PR
cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest-cuda121; type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-cuda121-${{ github.event.number }}
cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-cuda121-${{ github.event.number }}

- name: Build and Push image cuda 12.1
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:server"
file: Dockerfile.cuda121
push: true # Push if merged
cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest-cuda121
cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest-cuda121
tags: ghcr.io/coqui-ai/xtts-streaming-server:latest-cuda121, ghcr.io/coqui-ai/xtts-streaming-server:main-cuda121-${{ github.sha }}
#build-args:
14 changes: 14 additions & 0 deletions server/Dockerfile.cuda121
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-devel
WORKDIR /app
COPY requirements.txt .
RUN python -m pip install --use-deprecated=legacy-resolver -r requirements.txt \
&& python -m pip cache purge

COPY main.py .

#Mark this 1 if you have older card
ENV NVIDIA_DISABLE_REQUIRE=0

ENV NUM_THREADS=2
EXPOSE 80
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]

0 comments on commit de53a25

Please sign in to comment.