Carleslc / AudioToText

Transcribe and translate audio to text using Whisper and DeepL.
https://carleslc.me/AudioToText
264 stars 33 forks source link

OutOfMemoryError: CUDA out of memory #1

Closed Carleslc closed 1 year ago

Carleslc commented 1 year ago

If you encounter this error in Google Colab, it means that your GPU has run out of RAM memory.

This usually happens with free accounts when using large models or long audio files.

Try the following solutions:

mrazzari commented 1 year ago

When trying to transcribe multiple files, I also get out of memory when doing the second run (using the large model). As if the process isn't releasing memory when done.

Carleslc commented 1 year ago

When trying to transcribe multiple files, I also get out of memory when doing the second run (using the large model). As if the process isn't releasing memory when done.

Yes, using open-source large model in free Colab account can fill the RAM in one single transcription if audio file is large (usually about 30 minutes but depends on the audio file). You need to restart the runtime to clear the RAM for each file if that happens. Another option is to use the API filling the api_key parameter, which will use the OpenAI servers to process the audio files (faster and without filling your RAM, but with a pricing cost).

Maybe it would be possible to release memory via code, but for the moment it seems whisper model does some data caching that fills the RAM and it's not released after the transcription.