Softcatala/whisper-ctranslate2

Docker image for running whisper-ctranslate2

extremelyonline opened this issue · 1 comments

Hello, just wanted to start a discussion about running whisper-ctranslate2 in Docker. Referencing #109 of faster-whisper, I came up with the following Dockerfile, which works.

# Use Ubuntu as base
FROM ubuntu:20.04

# Alternatively, use a base image with CUDA and cuDNN support
# FROM nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu20.04

# Install necessary dependencies
RUN apt-get update && apt-get install -y python3-pip

# Set the working directory
WORKDIR /app

# Copy the app code and requirements filed
COPY . /app

# Install dependencies
RUN pip3 install --no-cache-dir -r requirements.txt

# Install whisper-ctranslate2
RUN pip install -U whisper-ctranslate2

# Set the entry point
ENTRYPOINT ["whisper-ctranslate2"]

Build with: docker build -t asr .
Run with: docker run --rm -v /path/to/folder:/app --gpus '"device=0,1"' asr myfile.mp3 --compute_type int8

My observations are:

  • If the entrypoint is set, the container will not show transcribed lines as it runs. The result are only printed afterwards
  • However, The progress can be shown if you run the docker container (without the entrypoint) in interactive mode

If a memory limit is set via docker run/docker compose, whisper-ctranslate2 would return Killed when it fails to transcribe a large file.