Views
No views yet
1from transformers import AutoProcessor, MusicgenForConditionalGeneration
2
3# Load model and processor
4model = MusicgenForConditionalGeneration.from_pretrained("opentunesai/melodymasterv1")
5processor = AutoProcessor.from_pretrained("opentunesai/melodymasterv1")
6
7# Process text and generate music
8inputs = processor(
9 text=["happy rock song with electric guitar"],
10 padding=True,
11 return_tensors="pt",
12)
13
14audio_values = model.generate(**inputs, max_new_tokens=1500)1@article{copet2023simple,
2 title={Simple and Controllable Music Generation},
3 author={Jade Copet and Felix Kreuk and Itai Gat and Tal Remez and David Kant and Gabriel Synnaeve and Yossi Adi and Alexandre Défossez},
4 year={2023},
5 journal={arXiv preprint arXiv:2306.05284},
6}