Text-to-Audio
Audiocraft
magnet
alonzi commited on
Commit
f81fd6c
1 Parent(s): 6f9f508

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +182 -0
README.md CHANGED
@@ -1,3 +1,185 @@
1
  ---
 
 
 
 
2
  license: cc-by-sa-4.0
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ inference: true
3
+ tags:
4
+ - magnet
5
+
6
  license: cc-by-sa-4.0
7
+
8
+ pipeline_tag: text-to-audio
9
+ widget:
10
+ - text: "a funky house with 80s hip hop vibes"
11
+ example_title: "Prompt 1"
12
+ - text: "a chill song with influences from lofi, chillstep and downtempo"
13
+ example_title: "Prompt 2"
14
+ - text: "a catchy beat for a podcast intro"
15
+ example_title: "Prompt 3"
16
  ---
17
+
18
+ # MAGNeT - Small - 300M - 10secs
19
+
20
+ MAGNeT is a text-to-music model capable of generating high-quality music samples conditioned on text descriptions.
21
+ It is a masked generative non-autoregressive Transformer trained over a 32kHz EnCodec tokenizer with 4 codebooks sampled at 50 Hz.
22
+ Unlike prior work, MAGNeT doesn't require neither semantic token conditioning nor model cascading, and it generates all 4 codebooks using a single non-autoregressive Transformer.
23
+
24
+ MAGNeT was published in [Masked Audio Generation using a Single Non-Autoregressive Transformer](https://arxiv.org/abs/2401.04577) by *Alon Ziv, Itai Gat, Gael Le Lan, Tal Remez, Felix Kreuk, Alexandre Défossez, Jade Copet, Gabriel Synnaeve, Yossi Adi*.
25
+
26
+ Six checkpoints are released:
27
+ - [small-10secs](https://huggingface.co/facebook/magnet-small-10secs)
28
+ - [medium-10secs](https://huggingface.co/facebook/magnet-medium-10secs)
29
+ - [small-30secs](https://huggingface.co/facebook/magnet-small-30secs)
30
+ - [**medium-30secs** (this checkpoint)](https://huggingface.co/facebook/magnet-medium-30secs)
31
+ - [audio-small](https://huggingface.co/facebook/audio-magnet-small)
32
+ - [audio-medium](https://huggingface.co/facebook/audio-magnet-medium)
33
+
34
+ ## 🤗 Transformers Usage
35
+
36
+ Coming soon...
37
+
38
+ ## Audiocraft Usage
39
+
40
+ You can run MAGNeT locally through the original [Audiocraft library](https://github.com/facebookresearch/audiocraft):
41
+
42
+ 1. First install the [`audiocraft` library](https://github.com/facebookresearch/audiocraft)
43
+ ```
44
+ pip install git+https://github.com/facebookresearch/audiocraft.git
45
+ ```
46
+
47
+ 2. Make sure to have [`ffmpeg`](https://ffmpeg.org/download.html) installed:
48
+ ```
49
+ apt-get install ffmpeg
50
+ ```
51
+
52
+ 3. Run the following Python code:
53
+
54
+ ```py
55
+ from audiocraft.models import MAGNeT
56
+ from audiocraft.data.audio import audio_write
57
+
58
+ model = MAGNeT.get_pretrained("facebook/magnet-small-10secs")
59
+
60
+ descriptions = ["happy rock", "energetic EDM"]
61
+
62
+ wav = model.generate(descriptions) # generates 2 samples.
63
+
64
+ for idx, one_wav in enumerate(wav):
65
+ # Will save under {idx}.wav, with loudness normalization at -14 db LUFS.
66
+ audio_write(f'{idx}', one_wav.cpu(), model.sample_rate, strategy="loudness")
67
+ ```
68
+
69
+ ## Model details
70
+
71
+ **Organization developing the model:** The FAIR team of Meta AI.
72
+
73
+ **Model date:** MAGNeT was trained between November 2023 and January 2024.
74
+
75
+ **Model version:** This is the version 1 of the model.
76
+
77
+ **Model type:** MAGNeT consists of an EnCodec model for audio tokenization, an non-autoregressive language model based on the transformer architecture for music modeling. The model comes in different sizes: 300M, 1.5B; and two variants: a model trained for text-to-music generation task and a model trained for text-to-audio generation.
78
+
79
+ **Paper or resources for more information:** More information can be found in the paper [Masked Audio Generation using a Single Non-Autoregressive Transformer](https://arxiv.org/abs/2401.04577).
80
+
81
+ **Citation details:**
82
+ ```
83
+ @misc{ziv2024masked,
84
+ title={Masked Audio Generation using a Single Non-Autoregressive Transformer},
85
+ author={Alon Ziv and Itai Gat and Gael Le Lan and Tal Remez and Felix Kreuk and Alexandre Défossez and Jade Copet and Gabriel Synnaeve and Yossi Adi},
86
+ year={2024},
87
+ eprint={2401.04577},
88
+ archivePrefix={arXiv},
89
+ primaryClass={cs.SD}
90
+ }
91
+ ```
92
+
93
+ **License:** Code is released under MIT, model weights are released under CC-BY-NC 4.0.
94
+
95
+ **Where to send questions or comments about the model:** Questions and comments about MAGNeT can be sent via the [Github repository](https://github.com/facebookresearch/audiocraft) of the project, or by opening an issue.
96
+
97
+ ## Intended use
98
+ **Primary intended use:** The primary use of MAGNeT is research on AI-based music generation, including:
99
+
100
+ - Research efforts, such as probing and better understanding the limitations of generative models to further improve the state of science
101
+ - Generation of music guided by text to understand current abilities of generative AI models by machine learning amateurs
102
+
103
+ **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.
104
+
105
+ **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.
106
+
107
+ ## Metrics
108
+
109
+ **Models performance measures:** We used the following objective measure to evaluate the model on a standard music benchmark:
110
+
111
+ - Frechet Audio Distance computed on features extracted from a pre-trained audio classifier (VGGish)
112
+ - Kullback-Leibler Divergence on label distributions extracted from a pre-trained audio classifier (PaSST)
113
+ - CLAP Score between audio embedding and text embedding extracted from a pre-trained CLAP model
114
+
115
+ Additionally, we run qualitative studies with human participants, evaluating the performance of the model with the following axes:
116
+
117
+ - Overall quality of the music samples;
118
+ - Text relevance to the provided text input;
119
+
120
+ More details on performance measures and human studies can be found in the paper.
121
+
122
+ **Decision thresholds:** Not applicable.
123
+
124
+ ## Evaluation datasets
125
+
126
+ 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.
127
+
128
+ ## Training datasets
129
+
130
+ The model was trained on licensed data 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.
131
+
132
+ ## Evaluation results
133
+
134
+ Below are the objective metrics obtained on MusicCaps with the released model. Note that for the publicly released models, we used the state-of-the-art music source separation method,
135
+ namely the open source [Hybrid Transformer for Music Source Separation](https://github.com/facebookresearch/demucs) (HT-Demucs),
136
+ in order to keep only instrumental tracks. This explains the difference in objective metrics with the models used in the paper.
137
+
138
+ | Model | Frechet Audio Distance | KLD | Text Consistency |
139
+ |---|---|---|---|
140
+ | facebook/magnet-small-10secs | 4.22 | 1.11 | 0.28 |
141
+ | facebook/magnet-medium-10secs | 4.61 | 1.14 | 0.28 |
142
+ | facebook/magnet-small-30secs | 4.35 | 1.17 | 0.28 |
143
+ | **facebook/magnet-medium-30secs** | **4.63** | **1.20** | **0.28** |
144
+
145
+ More information can be found in the paper [Masked Audio Generation using a Single Non-Autoregressive Transformer](https://arxiv.org/abs/2401.04577), in the Results section.
146
+
147
+ ## Limitations and biases
148
+
149
+ **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 16K hours of data, we believe that scaling the model on larger datasets can further improve the performance of the model.
150
+
151
+ **Mitigations:** Tracks that include vocals have been removed from the data source using corresponding tags, and 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).
152
+
153
+ **Limitations:**
154
+
155
+ - The model is not able to generate realistic vocals.
156
+ - The model has been trained with English descriptions and will not perform as well in other languages.
157
+ - The model does not perform equally well for all music styles and cultures.
158
+ - The model sometimes generates end of songs, collapsing to silence.
159
+ - It is sometimes difficult to assess what types of text descriptions provide the best generations. Prompt engineering may be required to obtain satisfying results.
160
+
161
+ **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.
162
+
163
+ **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.
164
+
165
+ **Use cases:** Users must be aware of the biases, limitations and risks of the model. MAGNeT is a model developed for artificial intelligence research on music generation. As such, it should not be used for downstream applications without further investigation and mitigation of risks.
166
+
167
+
168
+ ## Audio-MAGNeT - Sound-effect generation models
169
+
170
+ ### Training datasets
171
+
172
+ The audio-magnet models were trained on the following data sources: a subset of AudioSet (Gemmeke et al., 2017), [BBC sound effects](https://sound-effects.bbcrewind.co.uk/), AudioCaps (Kim et al., 2019), Clotho v2 (Drossos et al., 2020), VGG-Sound (Chen et al., 2020), FSD50K (Fonseca et al., 2021), [Free To Use Sounds](https://www.freetousesounds.com/all-in-one-bundle/), [Sonniss Game Effects](https://sonniss.com/gameaudiogdc), [WeSoundEffects](https://wesoundeffects.com/we-sound-effects-bundle-2020/), [Paramount Motion - Odeon Cinematic Sound Effects](https://www.paramountmotion.com/odeon-sound-effects).
173
+
174
+ ### Evaluation datasets
175
+
176
+ The audio-magnet models (sound effect generation) were evaluated on the [AudioCaps benchmark](https://audiocaps.github.io/).
177
+
178
+ ### Evaluation results
179
+
180
+ Below are the objective metrics obtained with the released audio-magnet models on AudioCaps (consisting of 10-second long samples).
181
+
182
+ | Model | Frechet Audio Distance | KLD |
183
+ |---|---|---|
184
+ | facebook/audio-magnet-small | 3.21 | 1.42 |
185
+ | facebook/audio-magnet-medium | 2.32 | 1.64 |