Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
pipeline_tag: text-to-audio
|
3 |
+
library_name: audiocraft
|
4 |
+
language: en
|
5 |
+
tags:
|
6 |
+
- text-to-audio
|
7 |
+
- musicgen
|
8 |
+
- songstarter
|
9 |
+
license: cc-by-nc-4.0
|
10 |
+
---
|
11 |
+
|
12 |
+
# Model Card for musicgen-songstarter-v0.2
|
13 |
+
|
14 |
+
musicgen-songstarter-v0.2 is a [`musicgen-stereo-melody-large`](https://huggingface.co/facebook/musicgen-stereo-melody-large) fine-tuned on a dataset of melody loops from my Splice sample library. It's intended to be used to generate song ideas that are useful for music producers. It generates stereo audio in 32khz.
|
15 |
+
|
16 |
+
## Usage
|
17 |
+
|
18 |
+
Install [audiocraft](https://github.com/facebookresearch/audiocraft):
|
19 |
+
|
20 |
+
```
|
21 |
+
pip install -U git+https://github.com/facebookresearch/audiocraft#egg=audiocraft
|
22 |
+
```
|
23 |
+
|
24 |
+
Then, you should be able to load this model just like any other musicgen checkpoint here on the Hub:
|
25 |
+
|
26 |
+
```python
|
27 |
+
import torchaudio
|
28 |
+
from audiocraft.models import MusicGen
|
29 |
+
from audiocraft.data.audio import audio_write
|
30 |
+
|
31 |
+
model = MusicGen.get_pretrained('nateraw/musicgen-songstarter-v0.2')
|
32 |
+
model.set_generation_params(duration=8) # generate 8 seconds.
|
33 |
+
wav = model.generate_unconditional(4) # generates 4 unconditional audio samples
|
34 |
+
descriptions = ['acoustic, guitar, melody, trap, d minor, 90 bpm'] * 3
|
35 |
+
wav = model.generate(descriptions) # generates 3 samples.
|
36 |
+
|
37 |
+
melody, sr = torchaudio.load('./assets/bach.mp3')
|
38 |
+
# generates using the melody from the given audio and the provided descriptions.
|
39 |
+
wav = model.generate_with_chroma(descriptions, melody[None].expand(3, -1, -1), sr)
|
40 |
+
|
41 |
+
for idx, one_wav in enumerate(wav):
|
42 |
+
# Will save under {idx}.wav, with loudness normalization at -14 db LUFS.
|
43 |
+
audio_write(f'{idx}', one_wav.cpu(), model.sample_rate, strategy="loudness", loudness_compressor=True)
|
44 |
+
```
|