Instructions to use BinaryLight1011/Musicbeat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BinaryLight1011/Musicbeat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-audio", model="BinaryLight1011/Musicbeat")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("BinaryLight1011/Musicbeat", device_map="auto") - PEFT
How to use BinaryLight1011/Musicbeat with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Jefferson de Azevedo commited on
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: facebook/musicgen-small
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-to-audio
|
| 5 |
+
tags:
|
| 6 |
+
- lora
|
| 7 |
+
- musicgen
|
| 8 |
+
- music-generation
|
| 9 |
+
- peft
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# MusicGen LoRA Fine-Tuned
|
| 13 |
+
|
| 14 |
+
LoRA adapter fine-tuned on custom music dataset using `facebook/musicgen-small`.
|
| 15 |
+
|
| 16 |
+
## Como usar
|
| 17 |
+
|
| 18 |
+
```python
|
| 19 |
+
from transformers import AutoProcessor, MusicgenForConditionalGeneration
|
| 20 |
+
from peft import PeftModel
|
| 21 |
+
import torch, soundfile as sf
|
| 22 |
+
|
| 23 |
+
processor = AutoProcessor.from_pretrained("facebook/musicgen-small")
|
| 24 |
+
model = MusicgenForConditionalGeneration.from_pretrained("facebook/musicgen-small")
|
| 25 |
+
model.decoder = PeftModel.from_pretrained(model.decoder, "SEU_REPO_AQUI")
|
| 26 |
+
|
| 27 |
+
inputs = processor(text=["upbeat electronic music"], return_tensors="pt")
|
| 28 |
+
audio = model.generate(**inputs, max_new_tokens=256)
|
| 29 |
+
sf.write("output.wav", audio[0].cpu().numpy(), 32000)
|
| 30 |
+
```
|