yinruiqing / pyannote-whisper

498 stars 84 forks source link

Script exits with Cuda Error under Ubuntu WSL2 #3

Closed eplinux closed 1 year ago

eplinux commented 1 year ago

System: Ubuntu WSL2, Windows 11

Hey, when I run your script, I encounter the following error:

python3 -m pyannote_whisper.cli.transcribe "videoplayback.m4a" --model large --diarization True Traceback (most recent call last): File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/**/.local/lib/python3.8/site-packages/pyannote_whisper/cli/transcribe.py", line 124, in <module> cli() File "/home/**/.local/lib/python3.8/site-packages/pyannote_whisper/cli/transcribe.py", line 91, in cli model = load_model(model_name, device=device, download_root=model_dir) File "/home/**/.local/lib/python3.8/site-packages/whisper/__init__.py", line 115, in load_model return model.to(device) File "/home/**/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 987, in to return self._apply(convert) File "/home/**/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 639, in _apply module._apply(fn) File "/home/**/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 639, in _apply module._apply(fn) File "/home/**/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 639, in _apply module._apply(fn) [Previous line repeated 2 more times] File "/home/**/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 662, in _apply param_applied = fn(param) File "/home/**/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 985, in convert return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking) torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 26.00 MiB (GPU 0; 4.00 GiB total capacity; 3.22 GiB already allocated; 0 bytes free; 3.47 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

However, if I run nvidia-smi under Ubuntu, it displays that only 10MiB/4GB of GPU memory is used. I have the newest NVIDIA Cuda drivers installed.

kagevazquez commented 1 year ago

the model you're looking to use requires 10GB of VRAM to run. https://github.com/openai/whisper has the GPU memory requirements listed in its README.md. According to the chart you should be able to run tiny/base/small and get that error when trying to run medium and large models.