{"id":13566252,"url":"https://github.com/gabotechs/MusicGPT","last_synced_at":"2025-04-03T23:31:27.303Z","repository":{"id":237969747,"uuid":"795601045","full_name":"gabotechs/MusicGPT","owner":"gabotechs","description":"Generate music based on natural language prompts using LLMs running locally","archived":false,"fork":false,"pushed_at":"2025-02-09T10:06:29.000Z","size":1869,"stargazers_count":930,"open_issues_count":10,"forks_count":90,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-03-28T16:03:22.425Z","etag":null,"topics":["ai","gpt","llm","machine-learning","music"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gabotechs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-03T16:20:12.000Z","updated_at":"2025-03-27T22:55:51.000Z","dependencies_parsed_at":"2024-05-29T18:59:26.031Z","dependency_job_id":"a7304130-fbbc-471c-9286-9bfdb25b33e2","html_url":"https://github.com/gabotechs/MusicGPT","commit_stats":{"total_commits":176,"total_committers":4,"mean_commits":44.0,"dds":0.25,"last_synced_commit":"b2298e298c6ef0ecb2c30014c4a297666945ac4b"},"previous_names":["gabotechs/musicgpt"],"tags_count":66,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabotechs%2FMusicGPT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabotechs%2FMusicGPT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabotechs%2FMusicGPT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabotechs%2FMusicGPT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabotechs","download_url":"https://codeload.github.com/gabotechs/MusicGPT/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247097878,"owners_count":20883125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","gpt","llm","machine-learning","music"],"created_at":"2024-08-01T13:02:05.471Z","updated_at":"2025-04-03T23:31:27.297Z","avatar_url":"https://github.com/gabotechs.png","language":"Rust","funding_links":[],"categories":["Rust","AI music generators"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    \u003cspan\u003e MusicGPT\u003c/span\u003e\n    \u003cimg height=\"30\" src=\"assets/music-icon.svg\" alt=\"Signway logo\"/\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    Generate music based on natural language prompts using LLMs running locally.\n\u003c/p\u003e\n\n\nhttps://github.com/gabotechs/MusicGPT/assets/45515538/f0276e7c-70e5-42fc-817a-4d9ee9095b4c\n\u003cp align=\"end\"\u003e\n☝️ Turn up the volume!\n\u003c/p\u003e\n\n\n# Overview\n\nMusicGPT is an application that allows running the latest music generation\nAI models locally in a performant way, in any platform and without installing heavy dependencies\nlike Python or machine learning frameworks.\n\nRight now it only supports [MusicGen by Meta](https://audiocraft.metademolab.com/musicgen.html),\nbut the plan is to support different music generation models transparently to the user.\n\nThe main milestones for the project are:\n- [x] Text conditioned music generation\n- [ ] Melody conditioned music generation\n- [ ] Indeterminately long / infinite music streams\n\n# Install\n\n### Mac and Linux\n\nMusicGPT can be installed on Mac and Linux using `brew`:\n\n```shell\nbrew install gabotechs/taps/musicgpt\n```\n\n### Windows\n\nDownload and install MusicGPT's executable file [following this link](https://github.com/gabotechs/MusicGPT/releases/latest/download/musicgpt-x86_64-pc-windows-msvc.exe).\n\n### All platforms\n\nPrecompiled binaries are available for the following platforms:\n- [macOS Apple Silicon](https://github.com/gabotechs/MusicGPT/releases/latest/download/musicgpt-aarch64-apple-darwin)\n- [Linux x86_64](https://github.com/gabotechs/MusicGPT/releases/latest/download/musicgpt-x86_64-unknown-linux-gnu)\n- [Windows](https://github.com/gabotechs/MusicGPT/releases/latest/download/musicgpt-x86_64-pc-windows-msvc.exe)\n\nJust downloading them and executing them should be enough.\n\n### Docker (Recommend for running with CUDA)\n\nIf you want to run MusicGPT with a CUDA enabled GPU, this is the best way, as you only need to have [the basic\nNVIDIA drivers](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) installed in your system.\n\n```shell\ndocker pull gabotechs/musicgpt\n```\n\nOnce the image is downloaded, you can run it with:\n\n```shell\ndocker run -it --gpus all -p 8642:8642 -v ~/.musicgpt:/root/.local/share/musicgpt gabotechs/musicgpt --gpu --ui-expose\n```\n\n### With cargo\n\nIf you have the [Rust toolchain](https://www.rust-lang.org/tools/install) installed in your system, you can install it\nwith `cargo`.\n\n```shell\ncargo install musicgpt\n```\n\n# Usage\n\nThere are two ways of interacting with MusicGPT: the UI mode and the CLI mode.\n\n## UI mode\n\nThis mode will display a chat-like web application for exchanging prompts with the LLM. It will:\n- store your chat history \n- allow you to play the generated music samples whenever you want\n- generate music samples in the background\n- allow you to use the UI in a device different from the one executing the LLMs\n\nYou can run the UI by just executing the following command:\n\n```shell\nmusicgpt\n```\n\nYou can also choose different models for running inference, and whether to use a GPU or not, for example:\n\n```shell\nmusicgpt --gpu --model medium\n```\n\n\u003e [!WARNING]  \n\u003e Most models require really powerful hardware for running inference\n\nIf you want to use a CUDA enabled GPU, it's recommended that you run MusicGPT with Docker:\n\n```shell\ndocker run -it --gpus all -p 8642:8642 -v ~/.musicgpt:/root/.local/share/musicgpt gabotechs/musicgpt --ui-expose --gpu\n```\n\n## CLI mode\n\nThis mode will generate and play music directly in the terminal, allowing you to provide multiple\nprompts and playing audio as soon as it's generated. You can generate audio based on a prompt with\nthe following command:\n\n```shell\nmusicgpt \"Create a relaxing LoFi song\"\n```\n\nBy default, it produces a sample of 10s, which can be configured up to 30s:\n\n```shell\nmusicgpt \"Create a relaxing LoFi song\" --secs 30\n```\n\nThere's multiple models available, it will use the smallest one by default, but\nyou can opt into a bigger model:\n\n```shell\nmusicgpt \"Create a relaxing LoFi song\" --model medium\n```\n\n\u003e [!WARNING]  \n\u003e Most models require really powerful hardware for running inference\n\nIf you want to use a CUDA enabled GPU, it's recommended that you run MusicGPT with Docker:\n\n```shell\ndocker run -it --gpus all -v ~/.musicgpt:/root/.local/share/musicgpt gabotechs/musicgpt --gpu \"Create a relaxing LoFi song\"\n```\n\nYou can review all the options available running:\n\n```shell\nmusicgpt --help\n```\n\n# Benchmarks\n\nThe following graph shows the inference time taken for generating 10 seconds of audio using\ndifferent models on a Mac M1 Pro. For comparison, it's Python equivalent using https://github.com/huggingface/transformers\nis shown. \n\nThe command used for generating the 10 seconds of audio was:\n\n \n```shell\nmusicgpt '80s pop track with bassy drums and synth'\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eThis is the Python script used for generating the 10 seconds of audio\u003c/summary\u003e\n\n```python\nimport scipy\nimport time\nfrom transformers import AutoProcessor, MusicgenForConditionalGeneration\n\nprocessor = AutoProcessor.from_pretrained(\"facebook/musicgen-small\")\nmodel = MusicgenForConditionalGeneration.from_pretrained(\"facebook/musicgen-small\")\n\ninputs = processor(\n    text=[\"80s pop track with bassy drums and synth\"],\n    padding=True,\n    return_tensors=\"pt\",\n)\n\nstart = time.time()\naudio_values = model.generate(**inputs, max_new_tokens=500)\nprint(time.time() - start) # Log time taken in generation\n\nsampling_rate = model.config.audio_encoder.sampling_rate\nscipy.io.wavfile.write(\"musicgen_out.wav\", rate=sampling_rate, data=audio_values[0, 0].numpy())\n```\n\n\u003c/details\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg height=400 src=\"https://github.com/gabotechs/MusicGPT/assets/45515538/edae3c25-04e3-41c3-a2b5-c0829fa69ee3\"/\u003e\n\u003c/p\u003e\n\n# Storage\n\nMusicGPT needs access to your storage in order to save downloaded models and generated audios along with some\nmetadata needed for the application to work properly. Assuming your username is `foo`, it will store the data\nin the following locations:\n\n- Windows: `C:\\Users\\foo\\AppData\\Roaming\\gabotechs\\musicgpt`\n- MacOS: `/Users/foo/Library/Application\\ Support/com.gabotechs.musicgpt`\n- Linux: `/home/foo/.config/musicgpt`\n\n# License\n\nThe code is licensed under a [MIT License](./LICENSE), but the AI model weights that get downloaded\nat application startup are licensed under the [CC-BY-NC-4.0 License](https://spdx.org/licenses/CC-BY-NC-4.0)\nas they are generated based on the following repositories:\n\n- https://huggingface.co/facebook/musicgen-small\n- https://huggingface.co/facebook/musicgen-medium\n- https://huggingface.co/facebook/musicgen-large\n- https://huggingface.co/facebook/musicgen-melody\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabotechs%2FMusicGPT","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabotechs%2FMusicGPT","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabotechs%2FMusicGPT/lists"}