lfm25-strudel
LoRA fine-tune of LiquidAI/LFM2.5-350M for natural-language -> Strudel.cc live-coding music generation, fused with mlx-lm.
Contents
-
Root: fused MLX weights (
model.safetensors+ config/tokenizer), ready formlx-lminference. -
adapters/: LoRA adapter checkpoints saved during training (mlx-lmLoRA format, rank 32 / alpha 64). -
onnx/: ONNX exports of the fused model for cross-platform / non-MLX inference:model_fp32.onnx— full precisionmodel_bf16.onnx— bfloat16 weightsmodel_fp8.onnx— float8 (e4m3fn) weights
The ONNX graphs take
input_idsandattention_maskand returnlogits(no KV cache; each call is a full forward pass). They were exported from the fused weights after correctingmlx-lm's depthwise-conv weight layout ((dim, kernel, 1)) to thetransformersConv1dlayout ((dim, 1, kernel)) expected byLfm2ForCausalLM. The bf16/fp8 variants are weight-only casts of the fp32 graph (storage-size quants); verify operator/EP support for these dtypes before relying on them for compute.
Usage (MLX)
pip install mlx-lm
mlx_lm.generate --model <this-repo> --prompt "// a fun pop indian lofi beat"
Usage (ONNX Runtime)
import onnxruntime as ort
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained("<this-repo>")
sess = ort.InferenceSession("onnx/model_fp32.onnx", providers=["CPUExecutionProvider"])
inputs = tok("// a fun pop indian lofi beat\n", return_tensors="np")
logits = sess.run(None, {"input_ids": inputs["input_ids"], "attention_mask": inputs["attention_mask"]})[0]