What is MusicGen
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.
Meta's open source AI MusicGen turns text and melody into new songs
https://the-decoder.com/metas-open-source-ai-musicgen-turns-text-and-melody-into-new-songs/
- Github: https://github.com/facebookresearch/audiocraft
- HuggingFace: https://huggingface.co/spaces/facebook/MusicGen
- Paper: https://arxiv.org/abs/2306.05284
Steps for Colab
- Go to Google Colab
- Change Runtime
- Run code
- Try to generate sound
step 1. Go to Google Colab
https://colab.research.google.com/
step 2. Change Runtime
Click Runtime
and select GPU
step 3. Run code
!git clone -b dev https://github.com/camenduru/MusicGen-hf
cd MusicGen-hf/
!pip install -r requirements.txt
!python app.py
Installing python packages will take some time.
If everything works properly, you will see something like this.
step4. Try to generate sound
If you click the link Running on public URL:
, you will see Gardio.
Now time to create your own sound via prompt!
It would take around 1-2 minutes to generate a mp4 file.
Steps for Windows11
You need to install cuda11.7 on your Windows11.
- Create a venv
- Install pytorch
- Clone repo and install requirements
- Try to generate sound
step 1. Create a venv
python -m venv musicgen
# activate venv
./musicgen/scripts/activate
step 2. Install pytorch
This step will take some time.
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
step 3. Clone repo and install requirements
git clone https://github.com/facebookresearch/audiocraft.git
cd audiocraft
pip install -e .
step 4. Try to generate sound
As Google Colab, we will run web ui with the following command.
python app.py