Get started with Audiocraft

In this video we'll use Audiocraft, an open source library from Facebook, to create a fully customizable interface for generating AI audio. Because the instructions and latest code seem to not work for most people, this video will show you how to get around the issues, and up and running smoothly.

machine learning, audiocraft,ai,stable audio,generative music

Links

Dependencies

  • Python >3.9
  • Pip
  • VirtualEnv
  • FFMpeg
  • Sourcetree (optional)
  • Code editor (recommend VSCode)

Clone Repo

git clone https://github.com/facebookresearch/audiocraft.git
cd audiocraft

Switch to release v0.0.2:

In sourcetree: TAGS > v0.0.2 > branch v0.0.2

In cmd line:

git fetch --all --tags --prune
git checkout tags/v0.0.2 -b v0.0.2

Activate virtual environment

python -m venv venv

Windows: venv\Scripts\Activate.ps1

Mac: source ./venv/bin/activate

Edit the requirements.txt to remove the xformers line

# xformers (the '#' will comment out the requirement)

Now install audiocraft in the venv

pip install -e .

edit the file audiocraft/modules/transformer.py

line 23 comment out the line from xformers import ops

line 178

self.memory_efficient = memory_efficient

becomes

self.memory_efficient = False

line 190 remove or comment out the memory_efficient check

#     if memory_efficient:
#         _verify_xformers_memory_efficient_compat()

line 373 change:

q, k, v = ops.unbind(packed, dim=2)

to:

q, k, v = torch.unbind(packed, dim=2)

Run the app:

python app.py

Open It:

CMD+Click to open the link and run musicgen in your browser!