SYSTRAN / faster-whisper

Faster Whisper transcription with CTranslate2
MIT License
12.69k stars 1.06k forks source link

Kernel dies when trying to run model.transcribe #752

Open everypidigit opened 8 months ago

everypidigit commented 8 months ago

I've been trying to make faster-whisper run on CUDA the whole day and it just does not work.

The model get initialized on CUDA with no issues, but when I try to actually run the model, it crashes the kernel.

The actual error message:

Screenshot 2024-03-20 at 16 49 04

text: "Kernel Restarting. The kernel for _SHARED/test.ipynb appears to have died. It will restart automatically"

I installed pytorch to a fresh Conda environment using this command from official Pytorch site: conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia

Then, I ran: pip install nvidia-cublas-cu11 nvidia-cudnn-cu11 export LD_LIBRARY_PATH=python3 -c 'import os; import nvidia.cublas.lib; import nvidia.cudnn.lib; print(os.path.dirname(nvidia.cublas.lib.__file__) + ":" + os.path.dirname(nvidia.cudnn.lib.__file__))'

Code I was trying to run when I got the error:

if torch.cuda.is_available():
    device = "cuda"
else:
    device = "cpu"

Whisper = WhisperModel(model_path, 
                       device=device, 
                       compute_type="int8")

audio = f"./daniyar/data/samples/sample_55.wav"

text = []

segments, info = Whisper.transcribe(audio, 
                                  beam_size=1, 
                                  vad_filter=True,
                                  vad_parameters=dict(min_silence_duration_ms=100),
                                  condition_on_previous_text=False,
                                  language="ru")

for segment in segments:
        text.append(segment.text)
text

I tried: 1) Installing 12th version cuda with: pip install nvidia-cublas-cu12 nvidia-cudnn-cu12 2) Downgrading to faster-whisper 0.10.1 3) Downgrading to faster-whisper 0.10.1 and installing 11th version cuda with: pip install nvidia-cublas-cu11 nvidia-cudnn-cu11

Could someone help me with this thing? It runs perfectly on the CPU, but the speed is lacking.

phineas-pta commented 8 months ago

provide more info about your system (hardware / os / python)

also pip install nvidia-cublas-* nvidia-cudnn-* is unnecessary, that's not how to change cuda version

kartikWorld commented 6 months ago

any updates here i'm getting the same error.

Quan2202 commented 5 months ago

I am getting this error, too

MengyiXiao11 commented 5 months ago

In my case, the issue arose due to the presence of multiple "libiomp5md.dll" files, which caused a conflict.

  1. I located all "libiomp5md.dll" in the system.
  2. Renaming or moving some of these files.

For example, I found this file in three different folders as following:

C:\ProgramData\anaconda3\envs\p04\Lib\site-packages\ctranslate2\libiomp5md.dll C:\ProgramData\anaconda3\envs\p04\Lib\site-packages\torch\lib\libiomp5md.dll C:\ProgramData\anaconda3\envs\p04\Library\bin\libiomp5md.dll

and I renamed the last one to "libiomp5md_save.dll", and solved the error.

Quan2202 commented 5 months ago

I fixed this error by converting the file .ipynb to a .py file. I don't know why but it works for me. Remember export LD_LIBRARY_PATH

pegahs1993 commented 2 months ago
import os
os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"

This works for me!

kausainshah commented 2 weeks ago

Downgrade ctranslate2 to 4.40 !pip install ctranslate2==4.4.0

mentejoao commented 2 weeks ago

Downgrade ctranslate2 to 4.40 !pip install ctranslate2==4.4.0

Thanks! This worked for me!

Habonit commented 4 days ago

Downgrade ctranslate2 to 4.40 !pip install ctranslate2==4.4.0

It works, too

My Computer Settings