Views
No views yet
| Metric | Test Set |
|---|---|
| BLEU | 97.17 |
| ROUGE-L | 97.43 |
| Exact Match | 84.78% |
| Valid Strudel Syntax | 100% |
1from transformers import T5ForConditionalGeneration, AutoTokenizer
2
3model = T5ForConditionalGeneration.from_pretrained("Adam-Ben-Khalifa/codet5p-strudel-music")
4tokenizer = AutoTokenizer.from_pretrained("Adam-Ben-Khalifa/codet5p-strudel-music")
5
6def generate_strudel(description, num_beams=5, max_length=384):
7 input_text = "generate strudel: " + description
8 inputs = tokenizer(input_text, return_tensors="pt", max_length=256, truncation=True)
9 outputs = model.generate(**inputs, max_new_tokens=max_length, num_beams=num_beams, early_stopping=True)
10 return tokenizer.decode(outputs[0], skip_special_tokens=True)
11
12# Generate music patterns!
13print(generate_strudel("Dark techno beat with heavy kick and industrial percussion"))
14# → stack(s("bd*4"), s("~ cp ~ cp"), s("hh*8").gain(0.4), note("c3 ~ e3 ~ g3 ~ e3 ~").s("triangle").gain(0.7))
15
16print(generate_strudel("Calm ambient drone with deep reverb and slowly evolving filter"))
17# → note("<c3 eb3 g3 bb3>").s("sine").room(0.9).roomsize(4).lpf(2000).slow(4)
18
19print(generate_strudel("Acid house with squelchy 303 bassline and resonant filter"))
20# → stack(s("bd*4"), note("c2 c2 c2 eb2").s("sawtooth").lpf(sine.range(200,4000).slow(4)).resonance(15))
21
22print(generate_strudel("Aggressive drum and bass breakbeat with wobbling bass"))
23# → stack(s("[bd ~ ~ bd] [~ ~ bd ~]").fast(2), s("[~ ~ ~ ~] [sd ~ ~ ~]").fast(2).room(0.3),
24# s("hh*16").gain(0.35).lpf(6000),
25# note("[c2 ~ c2 ~] [~ eb2 ~ c2]").s("sawtooth").lpf(sine.range(200,2000).fast(4)).fast(2))s() - sample triggers (drums, synths)note() - pitched notes with synth selectionn() - scale-degree notationstack() - layered patterns.fast(), .slow() - tempo modifiers.room(), .delay() - reverb/delay effects.lpf(), .hpf() - filters.gain(), .distort(), .crush() - dynamics.every(), .rev(), .degradeBy() - pattern transformations.cpm() - tempo in cycles per minute1@misc{codet5p-strudel-music,
2 title={CodeT5+ Strudel Music Generator},
3 author={Adam Ben Khalifa},
4 year={2026},
5 note={Fine-tuned on Salesforce/codet5p-220m for NL to Strudel code generation},
6 url={https://huggingface.co/Adam-Ben-Khalifa/codet5p-strudel-music}
7}