Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transcribe crash jupyter notebook kernels #820

Open
GiCollini opened this issue May 6, 2024 · 7 comments
Open

Transcribe crash jupyter notebook kernels #820

GiCollini opened this issue May 6, 2024 · 7 comments

Comments

@GiCollini
Copy link

The execution of the transcribe methods within a .ipynb jupyter notebook results in crashing the kernel (despite setting KMP_DUPLICATE_LIB_OK to True).
However, if I running the same exact code as a .py python script it works perfectly fine.

Here is a test code

import os
import nvidia.cublas.lib
import nvidia.cudnn.lib

from faster_whisper import WhisperModel, decode_audio

os.environ['LD_LIBRARY_PATH'] = os.path.dirname(nvidia.cublas.lib.__file__) + ":" + os.path.dirname(nvidia.cudnn.lib.__file__)
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'

model = WhisperModel("tiny")

left, right = decode_audio("stereo_diarization.wav", split_stereo=True)

segments, _ = model.transcribe(left)
transcription = "".join(segment.text for segment in segments).strip()

print("LEFT:")
print(transcription)
# EXPECTED
# "He began a confused complaint against the wizard, "
# "who had vanished behind the curtain on the left."

segments, _ = model.transcribe(right)
transcription = "".join(segment.text for segment in segments).strip()

print("RIGHT:")
print(transcription)
# EXPECTED
# "The horizon seems extremely distant."

The file "stereo_diarization.wav" is the one presented in the tests of this package faster-whisper/tests/data/stereo_diarization.wav

I used an the environment with Python 3.11.9 with the following package installed (full requirements here
requirements.txt)

pip install faster-whisper==1.0.2 nvidia-cublas-cu12==12.4.5.8 nvidia-cudnn-cu12==8.9.7.29 jupyter==1.0.0

I tested the notebook (always crashing) and the script (always OK) on a cloud instance with Ubuntu 22.04 (AWS EC2 ml.g4dn.xlarge) with NVIDIA Driver Version: 535.129.03 and CUDA Toolkit Version: 12.2

@benniekiss
Copy link

I am experiencing the same issue. Have you found any effective workaround or root cause?

@Null404bad
Copy link

Have you solved this? I have been suffering from this recently.

@benniekiss
Copy link

Have you solved this? I have been suffering from this recently.

I dont know the underlying cause, but the LD_LIBRARY_PATH env had become unset, and setting it before starting the jupyter server stopped the crashes.

I never had explicitly set it before and faster-whisper was working previously, but this has fixed my problem for now

@Null404bad
Copy link

Have you solved this? I have been suffering from this recently.

I dont know the underlying cause, but the LD_LIBRARY_PATH env had become unset, and setting it before starting the jupyter server stopped the crashes.

I never had explicitly set it before and faster-whisper was working previously, but this has fixed my problem for now

Thanks for your response. I also fix this but by uninstalling cuda 12, then installing cuda 11 (specifically 11.8) and downgrade the faster-whisper. The latest faster-whisper requires cuda 12 but cudnn for cuda 11. I guess most crash issues are caused by this. This is really weird, anyway.

See #717

@GiCollini
Copy link
Author

LD_LIBRARY_PATH env had become unset, and setting it before starting the jupyter server stopped the crashes.

Appartently once the jupyter kernel is running changing the LD_LIBRARY_PATH has no effect.
So setting LD_LIBRARY_PATH in the code works for running .py script, but not when running jupyter notebooks.

I am using vscode with the Jupyter extension for running the jupyter notebook (actually on a AWS Sagemaker Code Editor instance). I was able to setting the LD_LIBRARY_PATH by:

  • cloning the kernel.json of my environment (for me it is stored in the folder .conda/envs//share/jupyter/kernels/python3) into a new folder (name is not important) within the jupyter kernel references (.local/share/jupyter/kernels)
  • changing the dispaly name in the new kernel.json "display_name": "<NAME TO BE DISPLAYED>",
  • adding "env": {"LD_LIBRARY_PATH": "<CORRECT PATH>"}

Apparently changing the original kernel.json is not used when starting up the vscode jupyter kernel corresponding to the conda environment

@GiCollini
Copy link
Author

Have you solved this? I have been suffering from this recently.

I dont know the underlying cause, but the LD_LIBRARY_PATH env had become unset, and setting it before starting the jupyter server stopped the crashes.
I never had explicitly set it before and faster-whisper was working previously, but this has fixed my problem for now

Thanks for your response. I also fix this but by uninstalling cuda 12, then installing cuda 11 (specifically 11.8) and downgrade the faster-whisper. The latest faster-whisper requires cuda 12 but cudnn for cuda 11. I guess most crash issues are caused by this. This is really weird, anyway.

See #717

Actually faster-whisper==1.0.2 does not require any CUDA 11 dependences. This issue has been solved

@Null404bad
Copy link

Have you solved this? I have been suffering from this recently.

I dont know the underlying cause, but the LD_LIBRARY_PATH env had become unset, and setting it before starting the jupyter server stopped the crashes.
I never had explicitly set it before and faster-whisper was working previously, but this has fixed my problem for now

Thanks for your response. I also fix this but by uninstalling cuda 12, then installing cuda 11 (specifically 11.8) and downgrade the faster-whisper. The latest faster-whisper requires cuda 12 but cudnn for cuda 11. I guess most crash issues are caused by this. This is really weird, anyway.
See #717

Actually faster-whisper==1.0.2 does not require any CUDA 11 dependences. This issue has been solved

Thanks for sharing your solution. My current model in running normally and I'm exhausted by solving this problem : (
But I'll try this next time if it happens again. I'd like to be informed if this solution works for others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants