#nlp #music #llm #artificial-intelligence #ai #audio

app musicgpt

Generate music based on natural language prompts using LLMs running locally

21 releases

0.3.3 May 21, 2024
0.3.2 May 21, 2024
0.2.1 May 18, 2024
0.1.34 May 15, 2024

#191 in Machine learning

MIT license

1.5MB
4K SLoC

Rust 3K SLoC // 0.0% comments TSX 591 SLoC TypeScript 269 SLoC // 0.0% comments Shell 56 SLoC // 0.1% comments Ruby 28 SLoC // 0.2% comments JavaScript 17 SLoC

Signway logo MusicGPT

Generate music based on natural language prompts using LLMs running locally.

Install

Mac and Linux

MusicGPT can be installed on Mac and Linux using brew:

brew install gabotechs/taps/musicgpt

Or by directly downloading the precompiled binaries from this link

Windows

On Windows, the executable file can be downloaded from this link.

Docker (Recommend for running with CUDA)

If you want to run MusicGPT with a CUDA enabled GPU, this is the best way, as you only need to have the basic NVIDIA drivers installed in your system, everything else is bundled in the Docker image.

docker pull gabotechs/musicgpt

Once the image is downloaded, you can run it with:

docker run -it --gpus all -p 8642:8642 -v ~/.musicgpt:/root/.local/share/musicgpt gabotechs/musicgpt --gpu

With cargo

If you have the Rust toolchain installed in your system, you can install it with cargo.

cargo install musicgpt

Usage

There are two ways of interacting with MusicGPT: the UI mode and the CLI mode.

UI mode

This mode will display a chat-like web application for exchanging prompts with the LLM. It will store your chat history and allow you to play the generated music samples whenever you want. You can run the UI by just executing the following command:

musicgpt

You can also choose different models for running inference, and whether to use a GPU or not, for example:

musicgpt --gpu --model medium

[!WARNING]
Most models require really powerful hardware for running inference

If you want to use a CUDA enabled GPU, it's recommended that you run MusicGPT with Docker:

docker run -it --gpus all -p 8642:8642 -v ~/.musicgpt:/root/.local/share/musicgpt gabotechs/musicgpt --gpu

CLI mode

This mode will generate and play music directly in the terminal, allowing you to provide multiple prompts and playing audio as soon as it's generated. You can generate audio based on a prompt with the following command:

musicgpt "Create a relaxing LoFi song"

By default, it produces a sample of 10s, which can be configured

musicgpt "Create a relaxing LoFi song" --secs 30

There's multiple models available, it will use the smallest one by default, but users can opt into a bigger model

musicgpt "Create a relaxing LoFi song" --model medium

[!WARNING]
Most models require really powerful hardware for running inference

If you want to use a CUDA enabled GPU, it's recommended that you run MusicGPT with Docker:

docker run -it --gpus all -v ~/.musicgpt:/root/.local/share/musicgpt gabotechs/musicgpt --gpu "Create a relaxing LoFi song"

You can review all the options available running:

musicgpt --help

License

The code is licensed under a MIT License, but the AI model weights that get downloaded at application startup are licensed under the CC-BY-NC-4.0 License as they are generated based on the following repositories:

Dependencies

~34–71MB
~1M SLoC