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

Out of memory #16

Open
tomudo opened this issue Jul 13, 2023 · 1 comment
Open

Out of memory #16

tomudo opened this issue Jul 13, 2023 · 1 comment

Comments

@tomudo
Copy link

tomudo commented Jul 13, 2023

I test with 1:00 min wav file but it run out of GPU memory.

torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 138.00 MiB (GPU 0; 5.93 GiB total capacity; 4.99 GiB already allocated; 126.19 MiB free; 5.08 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

How could I run with a larger file?

@patharanordev
Copy link

Me too.
So I try 30 sec wav instead, it works!.

For the large file, please try to split out your audio file (.wav) to be multi-parts(or files). In each part, should have maximum range of wav file to be 30 sec.

Then loop get the result or write into your output file, ex. :

os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:512'

for fname in os.listdir(audio_folder):
  # Split your video into "temp_folder", 
  # you should clear this directory before split the new one
  split_audio(audio_folder, fname, temp_folder)

  # Loop get result
  for wavfile in os.listdir(temp_folder):
    torch.cuda.empty_cache()
    result = asr(data=f'{temp_folder}/{wavfile}', model=model, sampling_rate=16_000)
    print(result)
          
torch.cuda.empty_cache()
del os.environ['PYTORCH_CUDA_ALLOC_CONF']

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