OpenAI Whisper and GPU

Dear community,

I have a bit of Python code to transcribe Youtube Video (with Pytube) using OpenAI Whisper.
When I deployed the code on Google Colab, I need to enable GPU support for it to work.

Now I am deploying via the Streamlit cloud and receiving the following error.

/home/adminuser/venv/lib/python3.10/site-packages/whisper/transcribe.py:114: UserWarning: FP16 is not supported on CPU; using FP32 instead

  warnings.warn("FP16 is not supported on CPU; using FP32 instead")

2023-08-28 10:18:12.549 Uncaught app exception

Traceback (most recent call last):

  File "/home/adminuser/venv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script

    exec(code, module.__dict__)

  File "/mount/src/chatgptwithyourdata/ChatWithYourData_v2.py", line 75, in <module>

    output = model.transcribe("youtube_audio.mp4")

  File "/home/adminuser/venv/lib/python3.10/site-packages/whisper/transcribe.py", line 121, in transcribe

    mel = log_mel_spectrogram(audio, padding=N_SAMPLES)

  File "/home/adminuser/venv/lib/python3.10/site-packages/whisper/audio.py", line 140, in log_mel_spectrogram

    audio = load_audio(audio)

  File "/home/adminuser/venv/lib/python3.10/site-packages/whisper/audio.py", line 59, in load_audio

    out = run(cmd, capture_output=True, check=True).stdout

  File "/usr/local/lib/python3.10/subprocess.py", line 503, in run

    with Popen(*popenargs, **kwargs) as process:

  File "/usr/local/lib/python3.10/subprocess.py", line 971, in __init__

    self._execute_child(args, executable, preexec_fn, close_fds,

  File "/usr/local/lib/python3.10/subprocess.py", line 1863, in _execute_child

    raise child_exception_type(errno_num, err_msg, err_filename)

FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'

What should I do to make Whisper work?
Thanks!

Hey @nhtkid,

Unfortunately, Streamlit Community Cloud doesn’t provide GPUs, so that’s likely part of the issue. If your app needs a GPU, you may want to consider using something like Replicate which will allow you to make API calls to run a model using a GPU.

The FileNotFoundError seems like it might be related to not having ffmpeg installed (check out this thread) – if you haven’t included that package in your requirements file, I would go ahead and add it.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.