Skip to content

Commit

Permalink
add cuda dockerfile (#26)
Browse files Browse the repository at this point in the history
* add cuda dockerfile

* add guide to readme

* whisper update

* fix requirements.txt
  • Loading branch information
joschahenningsen authored Feb 14, 2023
1 parent feb568b commit ee39814
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 2 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/docker-publish-nvidia.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build & Deploy Voice Service Container

on:
push:
tags:
- '*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-nvidia
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=sha
flavor: |
latest=true
prefix=
suffix=
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile.nvidia
push: true
pull: true
build-args: version=${{ github.sha }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
14 changes: 14 additions & 0 deletions Dockerfile.nvidia
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM pytorch/pytorch:1.13.1-cuda11.6-cudnn8-runtime

ADD requirements.txt .

# Dependencies
RUN apt-get update && apt-get install -y git ffmpeg &&\
pip install --user --no-cache-dir -r requirements.txt

WORKDIR /usr/src/app

ADD subtitles/ ./subtitles/
ADD config.yml .

CMD ["python3", "./subtitles/subtitles.py"]
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,27 @@ Or simply use an open source IDE like [PyCharm CE](https://www.jetbrains.com/pyc
```bash
$ docker run -p 50055:50055 \
--name voice-service \
-v /srv/static:/data \
-v /srv/static:/mass \
-e CONFIG_FILE=./config.yml \
-e DEBUG=.\
-d \
ghcr.io/tum-dev/tum-live-voice-service:latest
```

To make use of Nvidia hardware acceleration build the `Dockerfile.nvidia`:

```bash
$ docker build -t tum-live-voice-service-nvidia --file Dockerfile.nvidia .
$ docker run -p 50055:50055 \
--name voice-service \
--gpus all \
-v /srv/static:/mass \
-e CONFIG_FILE=./config.yml \
-e DEBUG=.\
-d \
tum-live-voice-service-nvidia:latest
```

## Configuration

You can configure the application with:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ typing_extensions==4.4.0
urllib3==1.26.13
vosk==0.3.44
websockets==10.4
whisper @ git+https://github.com/openai/whisper.git@4179ed2475cc84cba66868b516232ef1b74dacdf
openai-whisper==20230124

0 comments on commit ee39814

Please sign in to comment.