yannis-schmutz
commited on
Commit
•
96f4874
1
Parent(s):
4b0e149
Create initial version of model card
Browse files
README.md
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
inference: false
|
3 |
+
tags:
|
4 |
+
- musicgen
|
5 |
+
license: cc-by-nc-4.0
|
6 |
+
pipeline_tag: text-to-audio
|
7 |
+
---
|
8 |
+
|
9 |
+
# MeditationMusicGen
|
10 |
+
|
11 |
+
This model is a fine-tuned version of facebooks MusicGen.
|
12 |
+
Refer to https://huggingface.co/facebook/musicgen-small for more details.
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
## 🤗 Transformers Usage
|
17 |
+
|
18 |
+
You can run MeditationMusicGen locally with the 🤗 Transformers library from version 4.31.0 onwards.
|
19 |
+
|
20 |
+
1. First install the 🤗 [Transformers library](https://github.com/huggingface/transformers) and scipy:
|
21 |
+
|
22 |
+
```
|
23 |
+
pip install --upgrade pip
|
24 |
+
pip install --upgrade transformers scipy
|
25 |
+
```
|
26 |
+
|
27 |
+
```python
|
28 |
+
from transformers import AutoProcessor, MusicgenForConditionalGeneration
|
29 |
+
import scipy
|
30 |
+
|
31 |
+
processor = AutoProcessor.from_pretrained("facebook/musicgen-small")
|
32 |
+
model = MusicgenForConditionalGeneration.from_pretrained("bfh-genai/meditation-musicgen")
|
33 |
+
|
34 |
+
relaxing_description = 'Peaceful meditation background sound'
|
35 |
+
|
36 |
+
conditioned_text_input = processor(text=relaxing_description, padding=True, return_tensors="pt")
|
37 |
+
|
38 |
+
audio_value = model.generate(**conditioned_text_input,
|
39 |
+
do_sample=True,
|
40 |
+
guidance_scale=3, # Value >1, best results achieved with 3.
|
41 |
+
max_new_tokens=256 # 256 ^= 5 seconds of audio.
|
42 |
+
)
|
43 |
+
|
44 |
+
scipy.io.wavfile.write(f"my_audio.wav", rate=32_000, data=audio_values[0, 0].numpy())
|
45 |
+
```
|
46 |
+
|
47 |
+
**License:** Code is released under MIT, model weights are released under CC-BY-NC 4.0.
|
48 |
+
|
49 |
+
|
50 |
+
|