実現したいこと
Whisperを利用可能にしたい
前提
anaconda環境上でspyderを使用しています。
入門者です。
Whisperのインストール後、エラーにより利用不可。
Git:インストール済
↓
以下https://github.com/openai/whisper.gitのREADME.md
の通りに
↓
pip install -U openai-whisper
↓
pip install git+https://github.com/openai/whisper.git
↓
pip install --upgrade --no-deps --force-reinstall git+https://github.com/openai/whisper.git
↓
scoop install ffmpeg
をWindows PowerShellで行動済み
ファイルパスはコピーしたものを貼り付けている
発生している問題・エラーメッセージ
input_file=C:\Users\ユーザー名\OneDrive\デスクトップ\VScode_sample\Whisper_sample_input.wav output_file=\Whisper_sample_output C:\Users\ユーザー名\anaconda3\Lib\site-packages\whisper\transcribe.py:114: UserWarning: FP16 is not supported on CPU; using FP32 instead warnings.warn("FP16 is not supported on CPU; using FP32 instead") Traceback (most recent call last): File ~\anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec exec(code, globals, locals) File c:\users\ユーザー名\onedrive\デスクトップ\vscode_sample\use_whisper.py:15 result = model.transcribe(input_file, verbose=True, language='ja') File ~\anaconda3\Lib\site-packages\whisper\transcribe.py:121 in transcribe mel = log_mel_spectrogram(audio, padding=N_SAMPLES) File ~\anaconda3\Lib\site-packages\whisper\audio.py:140 in log_mel_spectrogram audio = load_audio(audio) File ~\anaconda3\Lib\site-packages\whisper\audio.py:59 in load_audio out = run(cmd, capture_output=True, check=True).stdout File ~\anaconda3\Lib\subprocess.py:548 in run with Popen(*popenargs, **kwargs) as process: File ~\anaconda3\Lib\site-packages\spyder_kernels\customize\spydercustomize.py:109 in __init__ super(SubprocessPopen, self).__init__(*args, **kwargs) File ~\anaconda3\Lib\subprocess.py:1026 in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File ~\anaconda3\Lib\subprocess.py:1538 in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] 指定されたファイルが見つかりません。
該当のソースコード
Python
1import whisper 2 3# モデルの読み出し(今回はsmallモデルを利用) 4#モデルはtiny,base,small,medium,largeの順に高精度、高負荷 5model = whisper.load_model("small") 6 7 8# inputfile,outputfileの定義て 9input_file = r"C:\Users\ユーザー名\OneDrive\デスクトップ\VScode_sample\Whisper_sample_input.wav" 10output_file = r"C:\Users\ユーザー名\OneDrive\デスクトップ\VScode_sample\Whisper_sample_output" 11 12print("input_file="+input_file) 13print("output_file="+output_file) 14# print result 15result = model.transcribe(input_file, verbose=True, language='ja') 16print(result["text"]) 17 18# write txt file 19with open(output_file, "w", encoding="utf_8") as f: 20 f.write(result["text"]) 21
input_file,output_fileの"ユーザー名"のみ変更しています。
rは都合上Raw文字列にしています。
試したこと
BingAIやChatGPT-3.5と相談したところ、入力ファイルのパスは正しいのか・ファイル存在確認・Whisperのバージョン確認などとありました。(確認済)
「指定されたファイルが見つかりません」というエラーはffmpeg本体の未導入によるもの、という以前の投稿を見ましたが、今回は「scoop install ffmpeg」を用いたため問題ないと考えられる。
ffmpegのbinを環境変数pathに登録したが問題は解決しなかった。
補足情報(FW/ツールのバージョンなど)
Python(3.10.11)
Whisper(1)

回答1件
あなたの回答
tips
プレビュー