TuneLM-LFM3-1.7B-code2music
an executable music code generator
2 min readupdated
The TuneLM-LFM3-1.7B model turns a text description of music into ready-to-run JavaScript code for the Strudel music environment. The output gives you structured compositional notes and the program code itself, which you can listen to and edit. The project is built on the compact LiquidAI LFM3 language model (1.7 billion parameters) and was trained via SFT (supervised fine-tuning) and GRPO (group relative policy optimization). It is a great fit for developers, musicians, and algorithmic composition enthusiasts.
Key features
- Strudel specialization: the model is trained to write valid code for the Strudel music engine.
- Thought process: generates compositional notes in a special reasoning block before outputting the code.
- GRPO optimization: the checkpoint was trained with reinforcement learning to respect musical constraints and structure.
- Compactness: the base of just 1.7 billion parameters runs fast and efficiently.
What you can do
- Create a groove: generate drums and a bassline from a simple text prompt.
- Write an algorithmic track: compose a complete instrumental piece in JavaScript.
- Integrate into a web service: use the project's work to build interactive music generators.
Example
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "tensorfiend/TuneLM-LFM3-1.7B-code2music-2011"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
dtype=torch.bfloat16,
device_map="auto",
)
model.eval()Read more
DetailsBenchmarks: 45 out of 48 successful responses (93.75%) on the test set
Requirements: supports context up to 6,144 tokens, generates up to 3,072 new tokens
Format: Safetensors, bfloat16
License: LFM Open License v1.0










Comments