Closed3

音声認識 kotoba-whisper-v2.2を試す

moriokamorioka

話者識別を例によってpyannoteで行っている。

これを利用したくない(できるだけ、外のトークンが必要な状況にはしたくない)。

その前段階として、ローカルにキャッシュした後はオフラインで動作させるのは、以下の記事でできそう。

https://dev.classmethod.jp/articles/pyannote-audio-offline/
https://github.com/pyannote/pyannote-audio/blob/develop/tutorials/applying_a_pipeline.ipynb

python --version
#Python 3.11.8
speechbrain               1.0.2
pyannote.audio            3.3.2
torch                     2.6.0
torchaudio                2.6.0
#ipyhton
#torchtext
#torchvision

↑いちおう、この環境で動作している。

あとはそのまま

# キャッシュフォルダを変更
import os
os.environ['HUGGINGFACE_HUB_CACHE'] = './assets'  # デフォルト(未指定)の場合は ~/.cache/huggingface/hub

# モデルをダウンロード
# 念のため、 speaker-diarizationとsegmeantationもsnapshot_downloadですべて取得した
HF_TOKEN = "{作成したHugging Faceのトークン}"

from huggingface_hub import hf_hub_download, snapshot_download

config_path = hf_hub_download(repo_id="pyannote/speaker-diarization",
    filename="config.yaml",
    use_auth_token=HF_TOKEN)

segmentation_model_path = hf_hub_download(repo_id="pyannote/segmentation",
    filename="pytorch_model.bin",
    use_auth_token=HF_TOKEN)

snapshot_download("speechbrain/spkrec-ecapa-voxceleb")

# pyannote/speaker-diarization/config.yaml と pyannote/segmentation/pytorch_model.bin を別出し
!cp -L {segmentation_model_path} ./assets/pytorh_model.bin
!cp -L {config_path} ./assets/config.yaml
!rm -rf ./assets/models--pyannote--segmentation
!rm -rf ./assets/models--pyannote--speaker-diarization

!zip -r assets.zip ./assets
このスクラップは2025/02/05にクローズされました