simonrouard
commited on
Commit
•
4ff097d
1
Parent(s):
21e2f73
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,124 @@
|
|
1 |
-
---
|
2 |
-
license: cc-by-nc-4.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-nc-4.0
|
3 |
+
tags:
|
4 |
+
- musicgen
|
5 |
+
inference: false
|
6 |
+
---
|
7 |
+
|
8 |
+
# MusicGen-Style - 1.5B
|
9 |
+
|
10 |
+
AudioCraft provides the code and models for MusicGen-Style.
|
11 |
+
|
12 |
+
MusicGen-Style is a text-and-audio-to-music model that can be conditioned on textual and audio data (style conditioner).
|
13 |
+
The style conditioner takes as input a music excerpt of a few seconds (between 1.5 and 4.5) extracts some features that are used by the model to generate music in the same style.
|
14 |
+
This style conditioning can be mixed with textual description.
|
15 |
+
|
16 |
+
MusicGen-Style was published in [Audio Conditioning for Music Generation via Discrete Bottleneck Features](https://arxiv.org/abs/2407.12563) by *Simon Rouard, Yossi Adi, Jade Copet, Axel Roebel, Alexandre Défossez*.
|
17 |
+
|
18 |
+
|
19 |
+
## Example
|
20 |
+
|
21 |
+
Try out MusicGen-Style yourself!
|
22 |
+
|
23 |
+
- <a target="_blank" href="https://colab.research.google.com/drive/1fxGqfg96RBUvGxZ1XXN07s3DthrKUl4-?usp=sharing">
|
24 |
+
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
|
25 |
+
</a>
|
26 |
+
|
27 |
+
- <a target="_blank" href="https://huggingface.co/spaces/facebook/MusicGen">
|
28 |
+
<img src="https://huggingface.co/datasets/huggingface/badges/raw/main/open-in-hf-spaces-sm.svg" alt="Open in HugginFace"/>
|
29 |
+
</a>
|
30 |
+
|
31 |
+
- You can run MusicGen-Style locally:
|
32 |
+
|
33 |
+
1. First install the [`audiocraft` library](https://github.com/facebookresearch/audiocraft)
|
34 |
+
```
|
35 |
+
pip install git+https://github.com/facebookresearch/audiocraft.git
|
36 |
+
```
|
37 |
+
|
38 |
+
2. Make sure to have [`ffmpeg`](https://ffmpeg.org/download.html) installed:
|
39 |
+
```
|
40 |
+
apt get install ffmpeg
|
41 |
+
```
|
42 |
+
|
43 |
+
3. Run the following Python code:
|
44 |
+
|
45 |
+
```py
|
46 |
+
import torchaudio
|
47 |
+
from audiocraft.models import MusicGen
|
48 |
+
from audiocraft.data.audio import audio_write
|
49 |
+
|
50 |
+
model = MusicGen.get_pretrained('style')
|
51 |
+
model.set_generation_params(duration=8) # generate 8 seconds.
|
52 |
+
|
53 |
+
descriptions = ['happy rock', 'energetic EDM', 'sad jazz']
|
54 |
+
|
55 |
+
melody, sr = torchaudio.load('./assets/bach.mp3')
|
56 |
+
# generates using the melody from the given audio and the provided descriptions.
|
57 |
+
wav = model.generate_with_chroma(descriptions, melody[None].expand(3, -1, -1), sr)
|
58 |
+
|
59 |
+
for idx, one_wav in enumerate(wav):
|
60 |
+
# Will save under {idx}.wav, with loudness normalization at -14 db LUFS.
|
61 |
+
audio_write(f'{idx}', one_wav.cpu(), model.sample_rate, strategy="loudness")
|
62 |
+
```
|
63 |
+
|
64 |
+
|
65 |
+
## Model details
|
66 |
+
|
67 |
+
**Organization developing the model:** The FAIR team of Meta AI.
|
68 |
+
|
69 |
+
**Model date:** MusicGen-Style was trained between September 2023 and December 2023.
|
70 |
+
|
71 |
+
**Model version:** This is the version 1 of the model.
|
72 |
+
|
73 |
+
**Model type:** MusicGen-Style consists of an EnCodec model for audio tokenization, an auto-regressive language model based on the transformer architecture for music modeling. The model size is 1.5B. It takes short audio excerpts for style extraction as well as text as inputs to generate music.
|
74 |
+
|
75 |
+
**Paper or resources for more information:** More information can be found in the paper [Audio Conditioning for Music Generation via Discrete Bottleneck Features](https://arxiv.org/abs/2407.12563).
|
76 |
+
|
77 |
+
**Citation details:**
|
78 |
+
```
|
79 |
+
@misc{rouard2024audioconditioningmusicgeneration,
|
80 |
+
title={Audio Conditioning for Music Generation via Discrete Bottleneck Features},
|
81 |
+
author={Simon Rouard and Yossi Adi and Jade Copet and Axel Roebel and Alexandre Défossez},
|
82 |
+
year={2024},
|
83 |
+
eprint={2407.12563},
|
84 |
+
archivePrefix={arXiv},
|
85 |
+
primaryClass={cs.SD},
|
86 |
+
url={https://arxiv.org/abs/2407.12563},
|
87 |
+
}
|
88 |
+
```
|
89 |
+
|
90 |
+
**License:** Code is released under MIT, model weights are released under CC-BY-NC 4.0.
|
91 |
+
|
92 |
+
**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.
|
93 |
+
|
94 |
+
## Intended use
|
95 |
+
**Primary intended use:** The primary use of MusicGen-Style is research on AI-based music generation, including:
|
96 |
+
|
97 |
+
- Research efforts, such as probing and better understanding the limitations of generative models to further improve the state of science
|
98 |
+
- Generation of music guided by text or melody to understand current abilities of generative AI models by machine learning amateurs
|
99 |
+
|
100 |
+
**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.
|
101 |
+
|
102 |
+
**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.
|
103 |
+
|
104 |
+
|
105 |
+
## Limitations and biases
|
106 |
+
|
107 |
+
**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.
|
108 |
+
|
109 |
+
**Mitigations:** Vocals have been removed from the data source using corresponding tags, and then 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).
|
110 |
+
|
111 |
+
**Limitations:**
|
112 |
+
|
113 |
+
- The model is not able to generate realistic vocals.
|
114 |
+
- The model has been trained with English descriptions and will not perform as well in other languages.
|
115 |
+
- The model does not perform equally well for all music styles and cultures.
|
116 |
+
- The model sometimes generates end of songs, collapsing to silence.
|
117 |
+
- It is sometimes difficult to assess what types of text descriptions provide the best generations. Prompt engineering may be required to obtain satisfying results.
|
118 |
+
- It can be hard to balance well text description and the style condition. We recommend starting with cfg_coef=3 and cfg_coef_2=5. The first coefficient pushes the style conditioning and the second one pushes the text conditioning.
|
119 |
+
|
120 |
+
**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.
|
121 |
+
|
122 |
+
**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.
|
123 |
+
|
124 |
+
**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.
|