nateraw commited on
Commit
7386a58
·
verified ·
1 Parent(s): 08e8b48

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +62 -1
README.md CHANGED
@@ -10,4 +10,65 @@ tags:
10
 
11
  songstarter-v0.1 is a MusicGen 32k model fine-tuned on a dataset of hip-hop/rap/trap/rnb/soul melody loops. It's intended to be used to generate song ideas that are useful for music producers.
12
 
13
- This is a proof of concept. Hopefully, we will be able to collect more data and train a better models in the future.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  songstarter-v0.1 is a MusicGen 32k model fine-tuned on a dataset of hip-hop/rap/trap/rnb/soul melody loops. It's intended to be used to generate song ideas that are useful for music producers.
12
 
13
+ This is a proof of concept. Hopefully, we will be able to collect more data and train a better models in the future.
14
+
15
+ ## Usage
16
+
17
+ Install [audiocraft](https://github.com/facebookresearch/audiocraft):
18
+
19
+ ```
20
+ pip install -U git+https://github.com/facebookresearch/audiocraft#egg=audiocraft
21
+ ```
22
+
23
+ Then, you should be able to load this model just like any other musicgen checkpoint here on the Hub:
24
+
25
+ ```python
26
+ from audiocraft.models import musicgen
27
+
28
+ model = musicgen.MusicGen.get_pretrained('nateraw/songstarter-v0.1', device='cuda')
29
+ ```
30
+
31
+ To generate and save audio samples, you'd then do:
32
+
33
+ ```python
34
+ from datetime import datetime
35
+ from pathlib import Path
36
+
37
+ from audiocraft.models import musicgen
38
+ from audiocraft.data.audio import audio_write
39
+ from audiocraft.utils.notebook import display_audio
40
+
41
+ model = musicgen.MusicGen.get_pretrained('nateraw/songstarter-v0.1', device='cuda')
42
+
43
+ # path to save our samples.
44
+ out_dir = Path("./samples")
45
+ out_dir.mkdir(exist_ok=True, parents=True)
46
+
47
+ model.set_generation_params(
48
+ duration=15,
49
+ use_sampling=True,
50
+ temperature=1.0,
51
+ top_k=250,
52
+ cfg_coef=3.0,
53
+ )
54
+
55
+ text = "hip hop, soul, piano, chords, jazz, neo jazz, G# minor, 140 bpm"
56
+ N = 4
57
+ out = model.generate(
58
+ [text] * N,
59
+ progress=True,
60
+ )
61
+
62
+ # Write to files
63
+ dt_str = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
64
+ for i in range(N):
65
+ audio_write(
66
+ out_dir / f"{dt_str}_{i:02d}",
67
+ out[i].cpu(),
68
+ model.sample_rate,
69
+ strategy="loudness",
70
+ )
71
+
72
+ # Or, if in a notebook, display audio widgets
73
+ # display_audio(out, model.sample_rate)
74
+ ```