File size: 2,265 Bytes
49fefd0
 
 
 
 
 
cb56d69
76a934c
cb56d69
 
 
 
 
 
 
 
49fefd0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cb56d69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
license: mit
tags:
- audiocraft
base_model: facebook/musicgen-small
---

code on https://github.com/mateo19182/all-the-breaks

small model trained on 295 freely available drum breaks. No text conditioning was used (inspired by https://github.com/aaronabebe/micro-musicgen). 

only trained for 5 epochs, liked the sound there but can resume training with continue_from=checkpoint.th


useful docs: https://github.com/facebookresearch/audiocraft/blob/main/docs/TRAINING.md

examples:
  (picked at random)

<table style="width:100%; text-align:center;">
  <tr>
    <td>
      <audio controls>
        <source src="https://huggingface.co/mateo-19182/all-the-breaks/resolve/main/3.wav?download=true" type="audio/wav">
        Your browser does not support the audio element.
      </audio>
    </td>
    <td>
      <audio controls>
        <source src="https://huggingface.co/mateo-19182/all-the-breaks/resolve/main/sample_3.wav?download=true" type="audio/wav">
        Your browser does not support the audio element.
      </audio>
    </td>
  </tr>
  <tr>
    <td>
      <audio controls>
        <source src="https://huggingface.co/mateo-19182/all-the-breaks/resolve/main/9.wav?download=true" type="audio/wav">
        Your browser does not support the audio element.
      </audio>
    </td>
    <td>
      <audio controls>
        <source src="https://huggingface.co/mateo-19182/all-the-breaks/resolve/main/sample_9.wav?download=true" type="audio/wav">
        Your browser does not support the audio element.
      </audio>
    </td>
   </tr>
</table>



```
dora run solver=musicgen/musicgen_base_32khz model/lm/model_scale=small conditioner=none dataset.batch_size=5 dset=audio/breaks.yaml dataset.valid.num_samples=1 generate.every=10000 evaluate.every=10000 optim.optimizer=adamw optim.lr=1e-4 optim.adam.weight_decay=0.01 checkpoint.save_every=5
```


use: 

```
import torchaudio
from audiocraft.models import MusicGen
from audiocraft.data.audio import audio_write
model = MusicGen.get_pretrained('mateo-19182/all-the-breaks')
model.set_generation_params(duration=10)
wav = model.generate_unconditional(10)

for idx, one_wav in enumerate(wav):
    audio_write(f'{idx}', one_wav.cpu(), model.sample_rate, strategy="loudness", loudness_compressor=True)
```