MusicGPT

Jun 26, 2021 | Educational

Signway logo

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

Turn up the volume!

Overview

MusicGPT is an innovative application designed to run the latest music generation AI models locally, performing efficiently on any platform without the need for bulky dependencies such as Python or machine learning frameworks. Currently, it supports MusicGen by Meta, but future plans include support for various music generation models, all transparent to the user.

Here are some key milestones for the project:

  • [x] Text conditioned music generation
  • [ ] Melody conditioned music generation
  • [ ] Indeterminately long infinite music streams

Installation

Mac and Linux

You can install MusicGPT on Mac and Linux using the following command:

brew install gabotechstaps/musicgpt

Alternatively, you can download the precompiled binaries directly from this link.

Windows

On Windows, download the executable file from this link.

Docker (Recommended for running with CUDA)

For running MusicGPT with CUDA enabled GPU, the best approach is via Docker, requiring only the basic NVIDIA drivers. Execute the following commands:

docker pull gabotechsmusicgpt
docker run -it --gpus all -p 8642:8642 -v ~/.musicgpt:/root/.local/share/musicgpt gabotechsmusicgpt --gpu --ui-expose

With Cargo

If you have the Rust toolchain installed, you can install it using:

cargo install musicgpt

Usage

There are two ways to interact with MusicGPT: UI mode and CLI mode.

UI Mode

This mode presents a chat-like web application for exchanging prompts with the LLM. It will:

  • Store your chat history
  • Allow playback of generated music samples anytime
  • Generate music samples in the background
  • Let you use the UI on a different device

Run the UI using the following command:

musicgpt

You can also select different models and whether to utilize a GPU:

musicgpt --gpu --model medium

WARNING: Most models require powerful hardware for running inference. For optimal performance, consider running MusicGPT with Docker.

CLI Mode

This mode allows you to generate and play music directly in the terminal, providing multiple prompts and playing audio as it’s generated. Use the following command to create audio based on a prompt:

musicgpt Create a relaxing LoFi song

By default, it produces a 10-second sample, which can be extended up to 30 seconds like this:

musicgpt Create a relaxing LoFi song --secs 30

You can choose different available models as per your preference:

musicgpt Create a relaxing LoFi song --model medium

For a comprehensive list of options, run:

musicgpt --help

Benchmarks

The following graph indicates inference time required to generate 10 seconds of audio using various models on a Mac M1 Pro. As a comparison, the Python equivalent using Hugging Face Transformers is illustrated. The command used for generating the audio was:

musicgpt 80s pop track with bassy drums and synth

Storage

MusicGPT requires access to your storage to save downloaded models, generated audios, and necessary metadata. Data is stored in the following locations:

  • Windows: C:\Users\foo\AppData\Roaming\gabotech\musicgpt
  • MacOS: Users/foo/Library/Application Support/com.gabotechs.musicgpt
  • Linux: home/foo/.config/musicgpt

License

The code is licensed under the MIT License, but the AI model weights downloaded during startup are under the CC-BY-NC-4.0 License.

Troubleshooting

If you encounter issues while using MusicGPT, here are some troubleshooting steps you can take:

  • Check your installation paths. Ensure MusicGPT and all dependencies are correctly installed.
  • Verify your hardware capabilities, especially if running heavier models.
  • Consult the logs for error messages that might pinpoint the issue.
  • Reach out to community forums or resources for additional support.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox