🐑

whisper.cppを使ってみる [Mac]

に公開

はじめに

ローカルで音声認識(文字起こし)を試してみたかったので、軽量で無料のwhisper.cppを使ってみます。
https://github.com/ggml-org/whisper.cpp

手順

  1. クローンする
    git clone https://github.com/ggml-org/whisper.cpp.git
    
  2. ディレクトリに移動する
    cd whisper.cpp
    
  3. ggml形式に変換されたWhisperモデルのいずれかをダウンロードする
    例:
    sh ./models/download-ggml-model.sh base.en
    
    出力
    Done! Model 'base.en' saved in '略/whisper.cpp/models/ggml-base.en.bin'
    You can now use it like this:
    $ ./build/bin/whisper-cli -m 略/whisper.cpp/models/ggml-base.en.bin -f samples/jfk.wav
    
  4. whisper-cliをビルドする
    brew install cmakeをしておく
    cmake -B build
    cmake --build build -j --config Release
    
  5. 音声ファイルを書き起こし、txtファイルに保存する
    ./build/bin/whisper-cli -f samples/jfk.wav -otxt --no-gpu
    

結果

略/whisper.cpp/samplesのjfk.wav.txtに以下のように記述されており、無事に音声認識できました!

And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country.

Discussion