facebookresearch / audiocraft

Audiocraft is a library for audio processing and generation with deep learning. It features the state-of-the-art EnCodec audio compressor / tokenizer, along with MusicGen, a simple and controllable music generation LM with textual and melodic conditioning.
MIT License
20.71k stars 2.11k forks source link

GPU memory not being released after using demos/musicgen_app.py to complete a single inference #321

Open OroChippw opened 11 months ago

OroChippw commented 11 months ago

image Thank you very much for your contribution.But I found that after I used demos/musicgen_app.py to complete the text audio generation inference, my GPU memory was not released, and an OOM error occurred when I performed inference again. I had to close my service and reopen it, and proceed again. A reasoning. Is there something wrong with my operation?Think you~😊

0xlws commented 11 months ago

hey, i dont think there is anything wrong with your operation, please see:

tldr: 16gb recommended

https://github.com/facebookresearch/audiocraft/blob/main/docs/MUSICGEN.md#installation and https://github.com/facebookresearch/audiocraft/blob/main/docs/MUSICGEN.md#api

the model is being stored in memory which allows it to be used multiple times without having to unload/reload again (which can be time consuming the larger the model gets). as suggested in the readme you can try shorter audio lengths, or look for one of the many forks which allow for longer generations https://github.com/camenduru/MusicGen-colab (cant recommend any as i havent used them myself) hope it helps

OroChippw commented 11 months ago

Then it seems that I need to use better equipment to complete my task. Thank you for your answer 😊