OpenAIのWhisperで動画の文字起こしをしてみる

参考:

環境構築

FROM pytorch/pytorch:1.13.1-cuda11.6-cudnn8-runtime

WORKDIR /workspace

RUN apt-get update && apt-get install -y \
    build-essential \
    gcc \
    git \
    ffmpeg \
    && rm -rf /var/lib/apt/lists/*

RUN pip install --upgrade pip

RUN pip install git+https://github.com/openai/whisper.git

docker build -t whisper .

docker run --gpus all -it -d -v $(pwd):/workspace/ --name whisper whisper

docker exec -it whisper bash

ファイル変換

ffmpeg -i hoge.mp4 hoge.mp3

文字起こし

whisper --language ja --model small hoge.mp3

GPUの占有メモリのサイズを超えたモデルは使えない