https://github.com/airen3339/audiocraft

https://github.com/airen3339/audiocraft

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.6%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: airen3339
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 612 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 3 years ago · Last pushed about 3 years ago
Metadata Files
Readme Changelog Contributing License Code of conduct

README.md

Audiocraft

docs badge linter badge tests badge

Audiocraft is a PyTorch library for deep learning research on audio generation. At the moment, it contains the code for MusicGen, a state-of-the-art controllable text-to-music model.

MusicGen

Audiocraft provides the code and models for MusicGen, a simple and controllable model for music generation. MusicGen is a single stage auto-regressive Transformer model trained over a 32kHz EnCodec tokenizer with 4 codebooks sampled at 50 Hz. Unlike existing methods like MusicLM, MusicGen doesn't require a self-supervised semantic representation, and it generates all 4 codebooks in one pass. By introducing a small delay between the codebooks, we show we can predict them in parallel, thus having only 50 auto-regressive steps per second of audio. Check out our sample page or test the available demo!

Open In Colab Open in HugginFace

We use 20K hours of licensed music to train MusicGen. Specifically, we rely on an internal dataset of 10K high-quality music tracks, and on the ShutterStock and Pond5 music data.

Installation

Audiocraft requires Python 3.9, PyTorch 2.0.0, and a GPU with at least 16 GB of memory (for the medium-sized model). To install Audiocraft, you can run the following:

```shell

Best to make sure you have torch installed first, in particular before installing xformers.

Don't run this if you already have PyTorch installed.

pip install 'torch>=2.0'

Then proceed to one of the following

pip install -U audiocraft # stable release pip install -U git+https://git@github.com/facebookresearch/audiocraft#egg=audiocraft # bleeding edge pip install -e . # or if you cloned the repo locally ```

Usage

We offer a number of way to interact with MusicGen: 1. You can play with MusicGen by running the jupyter notebook at demo.ipynb locally, or use the provided colab notebook. 2. You can use the gradio demo locally by running python app.py. 3. A demo is also available on the facebook/MusicGen HuggingFace Space (huge thanks to all the HF team for their support). 4. Finally, you can run the Gradio demo with a Colab GPU, as adapted from @camenduru Colab.

API

We provide a simple API and 4 pre-trained models. The pre trained models are: - small: 300M model, text to music only - 🤗 Hub - medium: 1.5B model, text to music only - 🤗 Hub - melody: 1.5B model, text to music and text+melody to music - 🤗 Hub - large: 3.3B model, text to music only - 🤗 Hub

We observe the best trade-off between quality and compute with the medium or melody model. In order to use MusicGen locally you must have a GPU. We recommend 16GB of memory, but smaller GPUs will be able to generate short sequences, or longer sequences with the small model.

Note: Please make sure to have ffmpeg installed when using newer version of torchaudio. You can install it with: apt-get install ffmpeg

See after a quick example for using the API.

```python import torchaudio from audiocraft.models import MusicGen from audiocraft.data.audio import audio_write

model = MusicGen.getpretrained('melody') model.setgenerationparams(duration=8) # generate 8 seconds. wav = model.generateunconditional(4) # generates 4 unconditional audio samples descriptions = ['happy rock', 'energetic EDM', 'sad jazz'] wav = model.generate(descriptions) # generates 3 samples.

melody, sr = torchaudio.load('./assets/bach.mp3')

generates using the melody from the given audio and the provided descriptions.

wav = model.generatewithchroma(descriptions, melody[None].expand(3, -1, -1), sr)

for idx, onewav in enumerate(wav): # Will save under {idx}.wav, with loudness normalization at -14 db LUFS. audiowrite(f'{idx}', onewav.cpu(), model.samplerate, strategy="loudness", loudness_compressor=True) ```

Model Card

See the model card page.

FAQ

Will the training code be released?

Yes. We will soon release the training code for MusicGen and EnCodec.

I need help on Windows

@FurkanGozukara made a complete tutorial for Audiocraft/MusicGen on Windows

Citation

@article{copet2023simple, title={Simple and Controllable Music Generation}, author={Jade Copet and Felix Kreuk and Itai Gat and Tal Remez and David Kant and Gabriel Synnaeve and Yossi Adi and Alexandre Défossez}, year={2023}, journal={arXiv preprint arXiv:2306.05284}, }

License

  • The code in this repository is released under the MIT license as found in the LICENSE file.
  • The weights in this repository are released under the CC-BY-NC 4.0 license as found in the LICENSE_weights file.

Owner

  • Login: airen3339
  • Kind: user

GitHub Events

Total
Last Year

Dependencies

.github/actions/audiocraft_build/action.yml actions
  • actions/cache v2 composite
  • actions/setup-python v2 composite
.github/workflows/audiocraft_docs.yml actions
  • ./.github/actions/audiocraft_build * composite
  • actions/checkout v2 composite
.github/workflows/audiocraft_linter.yml actions
  • ./.github/actions/audiocraft_build * composite
  • actions/checkout v2 composite
.github/workflows/audiocraft_tests.yml actions
  • ./.github/actions/audiocraft_build * composite
  • actions/checkout v2 composite
requirements.txt pypi
  • av *
  • demucs *
  • einops *
  • flashy >=0.0.1
  • gradio *
  • huggingface_hub *
  • hydra-core >=1.1
  • hydra_colorlog *
  • julius *
  • librosa *
  • num2words *
  • numpy *
  • sentencepiece *
  • spacy ==3.5.2
  • torch >=2.0.0
  • torchaudio >=2.0.0
  • tqdm *
  • transformers *
  • xformers *
setup.py pypi