Views
No views yet
| Token | Bound Instrument |
|---|---|
sks0 | Flute (Saraga Carnatic timbre) |
sks1 | Veena (Saraga Carnatic timbre) |
1from transformers import AutoProcessor, MusicgenForConditionalGeneration
2from peft import PeftModel
3import torch, soundfile as sf
4
5processor = AutoProcessor.from_pretrained("YourUsername/saraga-dreambooth-musicgen")
6base_model = MusicgenForConditionalGeneration.from_pretrained("facebook/musicgen-small")
7model = PeftModel.from_pretrained(base_model, "YourUsername/saraga-dreambooth-musicgen")
8model = model.to("cuda").eval()
9
10inputs = processor(text=["sks0 Calm, Carnatic, Flute"], return_tensors="pt").to("cuda")
11
12with torch.no_grad():
13 audio = model.generate(**inputs, max_new_tokens=512, guidance_scale=5.0)
14
15sf.write("output.wav", audio[0, 0].cpu().numpy(), samplerate=32000)| Parameter | Value |
|---|---|
| Base model | facebook/musicgen-small |
| Method | Audio DreamBooth + LoRA |
| LoRA rank (r) | 32 |
| LoRA alpha | 64 |
| Target modules | q_proj, v_proj |
| Dataset | DevPanda004/saraga (90 clips) |
| Sample rate | 32000 Hz |
| Clip length | ~15 seconds |
| Epochs | 50 |
| Optimizer | AdamW + CosineAnnealingLR |
| Training loss | Instance loss + Prior loss |
sks0 Calm, Carnatic, Flutesks0 Hindustani — tests if timbre survives style changesks token to hear the generic base model outputsks tokens are arbitrary — only meaningful with this specific adaptermusicgen-small; larger base models may produce better quality