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

detect_language() doesn't work on a GPU? #782

Open
utility-aagrawal opened this issue Apr 16, 2024 · 2 comments
Open

detect_language() doesn't work on a GPU? #782

utility-aagrawal opened this issue Apr 16, 2024 · 2 comments

Comments

@utility-aagrawal
Copy link

Here's a simple script to identify language from an audio:

import whisperx
import time

start_time = time.time()
filepath = ""

whisper_model = whisperx.load_model("medium", device = "cuda", compute_type="float16")

audio = whisperx.load_audio(filepath)
audio = whisperx.audio.pad_or_trim(audio)

print(f"Language => {whisper_model.detect_language(audio)}")

end_time = time.time()
print(f"Time taken: {end_time - start_time:.2f} seconds")

You can use this file as an input:

Download-30secs.mp4

I am getting this error:

Could not load library libcudnn_cnn_infer.so.8. Error: libcudnn_cnn_infer.so.8: cannot open shared object file: No such file or directory
Please make sure libcudnn_cnn_infer.so.8 is in your library path!
Aborted (core dumped)

Can someone tell me why? Let me know if you need anythind additional. Thanks!

@utility-aagrawal
Copy link
Author

What I don't understand is how transcribe() works even if I keep everything else in the code unchanged.

This code works:

import whisperx
import time

start_time = time.time()
filepath = ""

whisper_model = whisperx.load_model("medium", device = "cuda", compute_type="float16")

audio = whisperx.load_audio(filepath)
audio = whisperx.audio.pad_or_trim(audio)

results = whisper_model.transcribe(audio)
print(results)

end_time = time.time()
print(f"Time taken: {end_time - start_time:.2f} seconds")

transcribe() also uses the same detect_language() method as you can see here:

language = language or self.detect_language(audio)

but this doesn't throw the same error.

@candrascik
Copy link

Adding the following to my Dockerfile fixed this issue. Make sure nvidia-cudnn-cu12 is <9.

RUN pip install nvidia-cudnn-cu12==8.9.7.29
ENV LD_LIBRARY_PATH /usr/local/lib/python3.10/dist-packages/nvidia/cudnn/lib:$LD_LIBRARY_PATH

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

2 participants