mlx-examples/musicgen
Seitaro Sugawara a6ae63226f
Update README.md
A small typo was fixed in the musicgen README.md.
2024-10-14 14:06:35 +09:00
..
benchmarks MusicGen (#1020) 2024-10-11 10:16:20 -07:00
encodec.py MusicGen (#1020) 2024-10-11 10:16:20 -07:00
generate.py MusicGen (#1020) 2024-10-11 10:16:20 -07:00
musicgen.py MusicGen (#1020) 2024-10-11 10:16:20 -07:00
README.md Update README.md 2024-10-14 14:06:35 +09:00
requirements.txt MusicGen (#1020) 2024-10-11 10:16:20 -07:00
t5.py MusicGen (#1020) 2024-10-11 10:16:20 -07:00
utils.py MusicGen (#1020) 2024-10-11 10:16:20 -07:00

MusicGen

An example of Meta's MusicGen model in MLX.1 MusicGen is used to generate music from text descriptions.

Setup

Install the requirements:

pip install -r requirements.txt

Example

An example using the model:

import mlx.core as mx
from musicgen import MusicGen
from utils import save_audio

model = MusicGen.from_pretrained("facebook/musicgen-medium")

audio = model.generate("happy rock")

save_audio("out.wav", audio, model.sampling_rate)

  1. Refer to the arXiv paper and code for more details. ↩︎