Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM python:3.9-slim AS builder

WORKDIR /build

# Install system build dependencies
RUN apt-get update && apt-get install -y build-essential

# Install Python build dependencies
RUN pip install pybind11[global]

# Copy application code
COPY . .

# Build project's wheels
RUN pip wheel --no-cache-dir --wheel-dir=/wheels -e .


FROM python:3.9-slim

WORKDIR /app

# Install required libraries
RUN apt-get update && apt-get install -y libgomp1 && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# Install the application
RUN --mount=type=bind,from=builder,source=/wheels,target=/wheels \
pip install --no-cache-dir --no-index --find-links=/wheels useful_transformers

# Set the application as the entrypoint
ENTRYPOINT ["taskset", "-c", "4-7", "python", "-m", "useful_transformers.transcribe_wav"]
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ If you don't have a wav file handy, running the above command will transcribe an
$ taskset -c 4-7 python -m useful_transformers.transcribe_wav
Ever tried, ever failed. No matter, try again. Fail again. Fail better.

### Try in Docker

You can also run the transcription in Docker with:
```bash
$ docker build -t useful-transformers .
$ docker run --rm -t \
--device /dev/dri:/dev/dri \
-v "$(PWD)":/work useful-transformers \
/work/<wav_file in CWD>
```

> **Note:** You can use `ffmpeg` to convert your audio file to a mono WAV file with a sample rate of 16 kHz:
> ```bash
> ffmpeg -i <input.*> -ac 1 -ar 16000 -f wav <output.wav>
> ```

## Performance

![Performance comparison](https://github.com/usefulsensors/useful-transformers/blob/main/examples/whisper/assets/perf-comparison.png)
Expand Down
1 change: 1 addition & 0 deletions lib/profiler.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "profiler.h"

#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
Expand Down