FROM pytorch/pytorch:1.9.0-cuda10.2-cudnn7-runtime
WORKDIR /workspace
RUN apt-get update && apt-get install -y \
build-essential \
gcc \
git \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --upgrade pip
RUN pip install git+https://github.com/openai/whisper.git
試してみるとエラーになった
root@dfbc095388f8:/workspace# whisper mtg02.m4a --language ja --model large
Traceback (most recent call last):
File "/opt/conda/bin/whisper", line 5, in <module>
from whisper.transcribe import cli
File "/opt/conda/lib/python3.7/site-packages/whisper/__init__.py", line 12, in <module>
from .decoding import DecodingOptions, DecodingResult, decode, detect_language
File "/opt/conda/lib/python3.7/site-packages/whisper/decoding.py", line 514
if prefix := self.options.prefix:
^
SyntaxError: invalid syntax
cudaのバージョン問題
参考にさせていただいたページにもあるように、pytorch をPCにあった cuda バージョンにする必要があります。
cudaバージョンの確認方法は、コマンドプロンプトで
>nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Jun__8_16:59:34_Pacific_Daylight_Time_2022
Cuda compilation tools, release 11.7, V11.7.99
Build cuda_11.7.r11.7/compiler.31442593_0
FROM pytorch/pytorch:1.13.1-cuda11.6-cudnn8-runtime
modelのダウンロードエラー?
実行してみると。。。
root@401ac01bcb2c:/workspace# whisper mtg03.m4a --language ja --model large
0%|▏ | 12.3M/2.87G [00:02<11:43, 4.37MiB/s]
Traceback (most recent call last):
File "/opt/conda/bin/whisper", line 8, in <module>
sys.exit(cli())
File "/opt/conda/lib/python3.10/site-packages/whisper/transcribe.py", line 310, in cli
model = load_model(model_name, device=device, download_root=model_dir)
File "/opt/conda/lib/python3.10/site-packages/whisper/__init__.py", line 108, in load_model
checkpoint_file = _download(_MODELS[name], download_root, in_memory)
File "/opt/conda/lib/python3.10/site-packages/whisper/__init__.py", line 62, in _download
raise RuntimeError("Model has been downloaded but the SHA256 checksum does not not match. Please retry loading the model.")
RuntimeError: Model has been downloaded but the SHA256 checksum does not not match. Please retry loading the model.
ん、Modelのダウンロードに失敗した? リトライしろってあるのでもう一度やってみる
root@401ac01bcb2c:/workspace# whisper mtg03.m4a --language ja --model large
/opt/conda/lib/python3.10/site-packages/whisper/__init__.py:48: UserWarning: /root/.cache/whisper/large-v2.pt exists, but the SHA256 checksum does not match; re-downloading the file
warnings.warn(f"{download_target} exists, but the SHA256 checksum does not match; re-downloading the file")
23%|████████▌ | 667M/2.87G [01:34<05:55, 6.71MiB/s]