patrickvonplaten commited on
Commit
633d907
1 Parent(s): fb75ef6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +149 -2
README.md CHANGED
@@ -4,5 +4,152 @@ tags:
4
  license: cc-by-nc-4.0
5
  ---
6
 
7
- Text-to-music model. 300M params LM trained on top of a 32 kHz Encodec model. See [github.com/facebookresearch/audiocraft](https://github.com/facebookresearch/audiocraft) for more details.
8
- The model is trained on MMI (Meta Music Initiative) + Shutterstock + Pond5.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  license: cc-by-nc-4.0
5
  ---
6
 
7
+ # MusicGen - Melody - 300M
8
+
9
+ Audiocraft provides the code and models for MusicGen, a simple and controllable model for music generation.
10
+ MusicGen is a single stage auto-regressive Transformer model trained over a 32kHz EnCodec tokenizer with 4 codebooks sampled at 50 Hz.
11
+ Unlike existing methods like MusicLM, MusicGen doesn't not require a self-supervised semantic representation, and it generates all 4 codebooks in one pass.
12
+ 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.
13
+
14
+ MusicGen was published in [Simple and Controllable Music Generation](https://arxiv.org/abs/2306.05284) by *Jade Copet, Felix Kreuk, Itai Gat, Tal Remez, David Kant, Gabriel Synnaeve, Yossi Adi, Alexandre Défossez*.
15
+
16
+ Four checkpoints are released:
17
+ - [**small** (this checkpoint)](https://huggingface.co/facebook/musicgen-small)
18
+ - [medium](https://huggingface.co/facebook/musicgen-medium)
19
+ - [large](https://huggingface.co/facebook/musicgen-large)
20
+ - [melody)](https://huggingface.co/facebook/musicgen-melody)
21
+
22
+ ## Example
23
+
24
+ Try out MusicGen yourself!
25
+
26
+ - <a target="_blank" href="https://colab.research.google.com/drive/1fxGqfg96RBUvGxZ1XXN07s3DthrKUl4-?usp=sharing">
27
+ <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
28
+ </a>
29
+
30
+ - <a target="_blank" href="https://huggingface.co/spaces/facebook/MusicGen">
31
+ <img src="https://huggingface.co/datasets/huggingface/badges/raw/main/open-in-hf-spaces-sm.svg" alt="Open in HugginFace"/>
32
+ </a>
33
+
34
+ - You can run MusicGen locally as well:
35
+
36
+ 1. First install the [`audiocraft` library](https://github.com/facebookresearch/audiocraft)
37
+ ```
38
+ pip install git+https://github.com/facebookresearch/audiocraft.git
39
+ ```
40
+
41
+ 2. Make sure to have [`ffmpeg`](https://ffmpeg.org/download.html) installed:
42
+ ```
43
+ apt get install ffmpeg
44
+ ```
45
+
46
+ 3. Run the following Python code:
47
+
48
+ ```py
49
+ import torchaudio
50
+ from audiocraft.models import MusicGen
51
+ from audiocraft.data.audio import audio_write
52
+ model = MusicGen.get_pretrained('melody')
53
+ model.set_generation_params(duration=8) # generate 8 seconds.
54
+ wav = model.generate_unconditional(4) # generates 4 unconditional audio samples
55
+ descriptions = ['happy rock', 'energetic EDM', 'sad jazz']
56
+ wav = model.generate(descriptions) # generates 3 samples.
57
+ melody, sr = torchaudio.load('./assets/bach.mp3')
58
+ # generates using the melody from the given audio and the provided descriptions.
59
+ wav = model.generate_with_chroma(descriptions, melody[None].expand(3, -1, -1), sr)
60
+ for idx, one_wav in enumerate(wav):
61
+ # Will save under {idx}.wav, with loudness normalization at -14 db LUFS.
62
+ audio_write(f'{idx}', one_wav.cpu(), model.sample_rate, strategy="loudness")
63
+ ```
64
+
65
+ ## Model details
66
+
67
+ **Organization developing the model:** The FAIR team of Meta AI.
68
+
69
+ **Model date:** MusicGen was trained between April 2023 and May 2023.
70
+
71
+ **Model version:** This is the version 1 of the model.
72
+
73
+ **Model type:** MusicGen consists of an EnCodec model for audio tokenization, an auto-regressive language model based on the transformer architecture for music modeling. The model comes in different sizes: 300M, 1.5B and 3.3B parameters ; and two variants: a model trained for text-to-music generation task and a model trained for melody-guided music generation.
74
+
75
+ **Paper or resources for more information:** More information can be found in the paper [Simple and Controllable Music Generation][https://arxiv.org/abs/2306.05284].
76
+
77
+ **Citation details**:
78
+ ```
79
+ @misc{copet2023simple,
80
+ title={Simple and Controllable Music Generation},
81
+ 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},
82
+ year={2023},
83
+ eprint={2306.05284},
84
+ archivePrefix={arXiv},
85
+ primaryClass={cs.SD}
86
+ }
87
+ ```
88
+
89
+ **License** Code is released under MIT, model weights are released under CC-BY-NC 4.0.
90
+
91
+ **Where to send questions or comments about the model:** Questions and comments about MusicGen can be sent via the [Github repository](https://github.com/facebookresearch/audiocraft) of the project, or by opening an issue.
92
+
93
+ ## Intended use
94
+ **Primary intended use:** The primary use of MusicGen is research on AI-based music generation, including:
95
+
96
+ - Research efforts, such as probing and better understanding the limitations of generative models to further improve the state of science
97
+ - Generation of music guided by text or melody to understand current abilities of generative AI models by machine learning amateurs
98
+
99
+ **Primary intended users:** The primary intended users of the model are researchers in audio, machine learning and artificial intelligence, as well as amateur seeking to better understand those models.
100
+
101
+ **Out-of-scope use cases** The model should not be used on downstream applications without further risk evaluation and mitigation. The model should not be used to intentionally create or disseminate music pieces that create hostile or alienating environments for people. This includes generating music that people would foreseeably find disturbing, distressing, or offensive; or content that propagates historical or current stereotypes.
102
+
103
+ ## Metrics
104
+
105
+ **Models performance measures:** We used the following objective measure to evaluate the model on a standard music benchmark:
106
+
107
+ - Frechet Audio Distance computed on features extracted from a pre-trained audio classifier (VGGish)
108
+ - Kullback-Leibler Divergence on label distributions extracted from a pre-trained audio classifier (PaSST)
109
+ - CLAP Score between audio embedding and text embedding extracted from a pre-trained CLAP model
110
+
111
+ Additionally, we run qualitative studies with human participants, evaluating the performance of the model with the following axes:
112
+
113
+ - Overall quality of the music samples;
114
+ - Text relevance to the provided text input;
115
+ - Adherence to the melody for melody-guided music generation.
116
+
117
+ More details on performance measures and human studies can be found in the paper.
118
+
119
+ **Decision thresholds:** Not applicable.
120
+
121
+ ## Data
122
+
123
+ The model is trained on MMI (Meta Music Initiative), Shutterstock, and Pond5.
124
+
125
+ ## Evaluation datasets
126
+
127
+ The model was evaluated on the [MusicCaps benchmark](https://www.kaggle.com/datasets/googleai/musiccaps) and on an in-domain held-out evaluation set, with no artist overlap with the training set.
128
+
129
+ ## Training datasets
130
+
131
+ The model was trained using the following sources: the [Meta Music Initiative Sound Collection](https://www.fb.com/sound), [Shutterstock music collection](https://www.shutterstock.com/music) and the [Pond5 music collection](https://www.pond5.com/). See the paper for more details about the training set and corresponding preprocessing.
132
+
133
+ ## Quantitative analysis
134
+
135
+ More information can be found in the paper [Simple and Controllable Music Generation][arxiv], in the Experimental Setup section.
136
+
137
+ ## Limitations and biases
138
+
139
+ **Data:** The data sources used to train the model are created by music professionals and covered by legal agreements with the right holders. The model is trained on 20K hours of data, we believe that scaling the model on larger datasets can further improve the performance of the model.
140
+
141
+ **Mitigations:** All vocals have been removed from the data source using a state-of-the-art music source separation method, namely using the open source [Hybrid Transformer for Music Source Separation](https://github.com/facebookresearch/demucs) (HT-Demucs). The model is therefore not able to produce vocals.
142
+
143
+ **Limitations:**
144
+
145
+ - The model is not able to generate realistic vocals.
146
+ - The model has been trained with English descriptions and will not perform as well in other languages.
147
+ - The model does not perform equally well for all music styles and cultures.
148
+ - The model sometimes generates end of songs, collapsing to silence.
149
+ - It is sometimes difficult to assess what types of text descriptions provide the best generations. Prompt engineering may be required to obtain satisfying results.
150
+
151
+ **Biases:** The source of data is potentially lacking diversity and all music cultures are not equally represented in the dataset. The model may not perform equally well on the wide variety of music genres that exists. The generated samples from the model will reflect the biases from the training data. Further work on this model should include methods for balanced and just representations of cultures, for example, by scaling the training data to be both diverse and inclusive.
152
+
153
+ **Risks and harms:** Biases and limitations of the model may lead to generation of samples that may be considered as biased, inappropriate or offensive. We believe that providing the code to reproduce the research and train new models will allow to broaden the application to new and more representative data.
154
+
155
+ **Use cases:** Users must be aware of the biases, limitations and risks of the model. MusicGen is a model developed for artificial intelligence research on controllable music generation. As such, it should not be used for downstream applications without further investigation and mitigation of risks.