0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WhisperX セットアップ・使い方ガイド(Mac / Apple Silicon)

0
Posted at

WhisperX セットアップ・使い方ガイド(Mac / Apple Silicon)

セットアップ

1. Miniconda のインストール

brew install miniconda
conda init zsh

ターミナルを再起動後:

# base環境の自動起動を無効化(推奨)
conda config --set auto_activate_base false

2. conda 環境の作成

conda create --name whisperx python=3.10 -y
conda activate whisperx

3. 依存パッケージのインストール

pip install torch==2.8.0 torchaudio==2.8.0
pip install torchvision==0.23.0
brew install ffmpeg
pip install whisperx

4. Hugging Face トークンの取得(話者分離を使う場合)

  1. huggingface.co で無料アカウントを作成(Gmailなど個人メール可)
  2. 以下のモデルページを開き、それぞれ「Agree」を押して利用規約に同意:
  3. Settings → Access Tokens でトークンを作成
    • Type: Read
    • 生成された hf_ で始まる文字列をコピーして保存

使い方

基本(文字起こしのみ)

conda activate whisperx

whisperx audio.wav \
  --model large-v2 \
  --language en \
  --compute_type float32

話者分離+タイムスタンプ付き

whisperx audio.wav \
  --model large-v2 \
  --language en \
  --compute_type float32 \
  --diarize \
  --hf_token ${HF_TOKEN}

出力形式を指定する

# テキストファイル(デフォルト)
--output_format txt

# 字幕ファイル
--output_format srt

# タイムスタンプ・話者情報付き詳細
--output_format json

出力先フォルダを指定する

--output_dir ./output

よく使うオプション一覧

オプション 説明
--model モデルサイズ tiny / base / small / medium / large-v2
--language 言語指定 ja(日本語)/ en(英語)
--compute_type 計算精度 float32(Mac推奨)
--diarize 話者分離を有効化 フラグのみ
--hf_token Hugging Faceトークン hf_xxxx...
--output_format 出力形式 txt / srt / json
--output_dir 出力先フォルダ ./output
--min_speakers 最小話者数 2
--max_speakers 最大話者数 5

Notes

conda 環境について

  • conda activate whisperx は毎回必要
  • conda config --set auto_activate_base false を設定すると、通常のzsh起動時にconda環境が有効にならない

Apple Silicon(M1〜M5)での注意

  • --compute_type float32 を必ず指定(float16 はエラーになる場合あり)
  • torch と torchvision のバージョンは必ず合わせること

Hugging Face 認証エラーが出る場合

  • $HF_TOKEN 変数が空でないか echo $HF_TOKEN で確認
  • 空の場合は --hf_token にトークンを直接貼り付ける
  • モデルの利用規約への同意が全て完了しているか確認

初回実行時

  • モデルのダウンロードが走るため時間がかかる(large-v2は約3GB)
  • 短い音声ファイルで動作確認してから本番ファイルを処理するのがおすすめ
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?