From 4004aab6441fa5f9c68247a6c820b1b1d0a8a588 Mon Sep 17 00:00:00 2001 From: Kasisnu <5044120+kasisnu@users.noreply.github.com> Date: Thu, 11 Jan 2024 16:04:54 +0530 Subject: [PATCH 1/2] minor updates to match file layout expected by inference runner --- tts/StyleTTS2/Dockerfile | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/tts/StyleTTS2/Dockerfile b/tts/StyleTTS2/Dockerfile index 7e9cb95..dd441ad 100644 --- a/tts/StyleTTS2/Dockerfile +++ b/tts/StyleTTS2/Dockerfile @@ -5,6 +5,12 @@ FROM nvidia/cuda:12.2.0-devel-ubuntu20.04 ENV MY_ENV_VARIABLE=value ENV DEBIAN_FRONTEND=noninteractive +RUN mkdir /python_install +RUN mkdir /model_code + +WORKDIR /python_install + + # Install necessary packages RUN apt-get update && apt-get install -y \ curl \ @@ -12,27 +18,33 @@ RUN apt-get update && apt-get install -y \ git \ ffmpeg \ espeak-ng \ - sudo \ - python3.10 \ - python3-pip + sudo # Install git-lfs RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash \ && apt-get install git-lfs \ && git lfs install +# rsync to copy between pods with rich logs +RUN apt-get install -y rsync -# Create a directory for our project -WORKDIR /TestingDockerIO +RUN add-apt-repository ppa:deadsnakes/ppa -# Copy only the necessary files from the host to the container -COPY StyleTTS2 /TestingDockerIO/StyleTTS2 +RUN apt-get update +RUN apt-get install -y python3.8 python3.8-venv python3.8-dev python3.8-full python3.8-distutils + +COPY requirements.txt . +# Install Python dependencies +RUN python3.8 -m venv python \ + && python/bin/pip install --upgrade pip wheel setuptools \ + && . python/bin/activate \ + && pip install -r requirements.txt # Change working directory to StyleTTS2 -WORKDIR /TestingDockerIO/StyleTTS2 +WORKDIR /model_code + +# Copy only the necessary files from the host to the container +COPY . . -# Install Python dependencies -RUN pip3 install --upgrade pip && \ - pip3 install -r requirements.txt # Clone the Git LFS repository and move the Models directory RUN git lfs clone https://huggingface.co/yl4579/StyleTTS2-LibriTTS && \ From 66e567c8d7b36634d65b1315906562d2b54ccf2b Mon Sep 17 00:00:00 2001 From: Kasisnu <5044120+kasisnu@users.noreply.github.com> Date: Thu, 11 Jan 2024 16:05:21 +0530 Subject: [PATCH 2/2] add github action for styletts2 image --- .../workflows/docker-publish-styletts2.yaml | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/docker-publish-styletts2.yaml diff --git a/.github/workflows/docker-publish-styletts2.yaml b/.github/workflows/docker-publish-styletts2.yaml new file mode 100644 index 0000000..9adc8a8 --- /dev/null +++ b/.github/workflows/docker-publish-styletts2.yaml @@ -0,0 +1,66 @@ +# Adapted from +# https://github.com/actions/starter-workflows/ci/docker-publish.yml +# If using base images, don't forget to add READ access, eg. from a package settings page like: +# https://github.com/orgs/storytold/packages/container/docker-base-images-rust-ssl/settings/actions_access +name: Build StyleTTS2 Docker Image +on: + push: + branches: + # NB: Default-branch doesn't work, despite Github's documentation. + #- $default-branch + - master +env: + IMAGE_NAME: styletts2 + +jobs: + # Push image to GitHub Packages. + # See also https://docs.docker.com/docker-hub/builds/ + push: + #runs-on: ubuntu-latest + runs-on: github-ubuntu-64core # NB: Premium GitHub runner with more cores + if: github.event_name == 'push' + permissions: + packages: write + contents: read + + steps: + - uses: actions/checkout@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + #username: ${{ github.repository_owner }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build image + run: cd tts/StyleTTS2/ && docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" + + - name: Push image to GitHub Container Registry + run: | + IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME + + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + + # Use Docker `latest` tag convention + [ "$VERSION" == "$default-branch" ] && VERSION=latest + + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION + + SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-12) + + docker tag $IMAGE_NAME $IMAGE_ID:$SHORT_SHA + docker push $IMAGE_ID:$SHORT_SHA +