diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index f28aa4e..74ab022 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,54 +1,19 @@ -name: Publish Docker image +name: Docker Image CI on: - release: - types: [published] + push: + branches: [ "main" ] + paths: + - Dockerfile + pull_request: + branches: [ "main" ] + paths: + - Dockerfile jobs: build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v3 - name: Build the Docker image run: docker build . --file Dockerfile --tag wyoming-whisper-gpu:$(date +%s) - - push_to_registries: - name: Push Docker image to multiple registries - runs-on: ubuntu-latest - permissions: - packages: write - contents: read - steps: - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Log in to Docker Hub - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Log in to the Container registry - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 - with: - images: | - slackr31337/wyoming-whisper-gpu - ghcr.io/${{ github.repository }} - - - name: Build and push Docker images - uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..f28aa4e --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,54 @@ +name: Publish Docker image + +on: + release: + types: [published] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag wyoming-whisper-gpu:$(date +%s) + + push_to_registries: + name: Push Docker image to multiple registries + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: | + slackr31337/wyoming-whisper-gpu + ghcr.io/${{ github.repository }} + + - name: Build and push Docker images + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 449e9a5..51c4d35 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ ########################################## -FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 +FROM nvidia/cuda:12.3.2-base-ubuntu22.04 ARG WHISPER_VERSION='2.4.0' @@ -42,7 +42,7 @@ RUN \ build-essential \ python3-dev &&\ \ - rm -rf /var/lib/apt/lists/* + apt clean && rm -rf /root/.cache/* /var/lib/apt/lists/* COPY run.sh . diff --git a/README.md b/README.md index d422488..8bd177a 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,7 @@ https://github.com/rhasspy/wyoming-faster-whisper docker pull ghcr.io/slackr31337/wyoming-whisper-gpu:latest -Default model: tiny-int8 - -Example models: +Models: - tiny-int8 - tiny.en @@ -34,15 +32,16 @@ Example models: - distil-small.en -Use environment variable to set model - Environment variables: -> MODEL=base-int8 +> MODEL=base-int8 (Name of faster-whisper model to use) > -> LANGUAGE=en +> LANGUAGE=en (Default language to set for transcription) +> +> COMPUTE_TYPE=int8 (float16, int8, etc.) +> +> BEAM_SIZE=5 (Size of beam during decoding. 0 for auto) > - # Docker compose @@ -52,6 +51,9 @@ Environment variables: container_name: wyoming-whisper environment: - MODEL=base-int8 + - LANGUAGE=en + - COMPUTE_TYPE=int8 + - BEAM_SIZE=5 ports: - 10300:10300 volumes: diff --git a/run.sh b/run.sh index b5940b8..b626e1d 100644 --- a/run.sh +++ b/run.sh @@ -1,10 +1,16 @@ #!/usr/bin/env bash +if [ -z "${HF_HUB_CACHE}" ];then + HF_HUB_CACHE=/tmp +fi + /app/bin/python3 -m wyoming_faster_whisper \ --uri 'tcp://0.0.0.0:10300' \ --data-dir /data \ --download-dir /data \ - --model "${MODEL:-tiny-int8}" \ + --model "${MODEL:-auto}" \ --language "${LANGUAGE:-en}" \ + --compute-type "${COMPUTE_TYPE:-int8}" \ + --beam-size "${BEAM_SIZE:-5}" \ --device cuda \ "$@"