Softcatala / whisper-ctranslate2

Whisper command line client compatible with original OpenAI client based on CTranslate2.
MIT License
860 stars 74 forks source link

Docker image for running whisper-ctranslate2 #75

Open extremelyonline opened 8 months ago

extremelyonline commented 8 months ago

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:

extremelyonline commented 8 months ago

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