公開対象: 学会参加者、講義聴講者等 (下記のAIの一部は、Tutorials - D2MatE の動画、資料を含んでいます)
文字起こしをする場合:
Windows:
AlmaLinux9:
以下のプログラムでは、OpenAI Whisperを使って文字起こしをしています。
文字起こししたデータには多くの誤字・誤変換が含まれるので、correc_transcript.pyを使って修正します (Google API Keyが必要です)
注: localで音声ファイルの文字起こしを行う場合、local版whispeをrインストールする必要があります。
local版whisperのインストール方法
2025/7/14現在、python 3.10以前が必要です。
> python3.10 -m venv whisper-env
> whisper-env\Scripts\activate
> pip install --upgrade pip
> pip install git+https://github.com/openai/whisper.git
# CUDA対応GPUがある場合
> pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
0. pipのインストール
dnf install python3 python3-pip python3-virtualenv -y
1. ffmpegのインストール
dnf install epel-release -y
dnf install https://download1.rpmfusion.org/free/el/rpmfusion-free-release-9.noarch.rpm
dnf install https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-9.noarch.rpm
dnf install ffmpeg ffmpeg-devel -y
2. CUDAのversion確認:
nvidia-smi
nvcc --version
CUDA Version: 12.9
3. pytorch(CUDA):のインストール
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu129
6. whisperのインストール
pip install git+https://github.com/openai/whisper.git
4. 動作確認
import torch
print(torch.cuda.is_available()) # TrueならOK
import whisper
model = whisper.load_model("medium").to("cuda")
result = model.transcribe("your_audio_file.mp3", language="ja")
print(result["text"])