This is not a full-stack pure MLX audio pipeline yet: token generation runs with MLX, while FLAC decoding currently uses the official PyTorch Flow1dVAE / separate-tokenizer bridge in
ailuntx/SongGeneration-MLX.
1git clone https://github.com/ailuntx/SongGeneration-MLX.git
2cd SongGeneration-MLX
3python -m venv .venv
4.venv/bin/pip install -e .
5.venv/bin/pip install -U huggingface_hub hf_transfer
6
7HF_HUB_ENABLE_HF_TRANSFER=1 .venv/bin/hf download mlx-community/SongGeneration-v2-medium-8bit --local-dir ./models/SongGeneration-v2-medium-8bit
8
9.venv/bin/python -m songgeneration_mlx.cli \
10 --model ./models/SongGeneration-v2-medium-8bit \
11 --lyrics '[verse] hello from mlx [chorus] sing it again' \
12 --description 'Pop, female vocal, bright production, [Musicality-medium].' \
13 --duration 2 \
14 --top-k 50 \
15 --temperature 0.9 \
16 --output tokens_2s.npz
The MLX runtime writes discrete song tokens. To create FLAC audio, use the official decoder bridge in
ailuntx/SongGeneration-MLX. The bridge needs the official SongGeneration
runtime/ assets, but it does not need the original SongGeneration LM
model.pt when
--mlx-model is used.
1python -m venv .venv-decoder
2.venv-decoder/bin/pip install -U pip
3.venv-decoder/bin/pip install \
4 -r third_party/SongGeneration/requirements.txt \
5 -r third_party/SongGeneration/requirements_nodeps.txt \
6 soundfile
7
8HF_HUB_ENABLE_HF_TRANSFER=1 .venv/bin/hf download tencent/SongGeneration \
9 --include "runtime/*" \
10 --local-dir ./third_party/SongGeneration
11
12PYTORCH_ENABLE_MPS_FALLBACK=1 SONGGEN_DEVICE=mps \
13.venv-decoder/bin/python scripts/decode_tokens_official.py \
14 --mlx-model ./models/SongGeneration-v2-medium-8bit \
15 --tokens ./tokens_2s.npz \
16 --output ./output_2s.flac \
17 --device mps
1SongGeneration-v2-medium-8bit/
2|-- model-00001-of-000xx.safetensors
3|-- model.safetensors.index.json
4|-- config.json
5|-- mlx_manifest.json
6|-- config.official.yaml
7|-- vocab.yaml
8`-- qwen2_tokenizer/
The official recent-token repetition penalty is implemented in the MLX runtime. Without it, 12s generations collapse into repeated tokens and decode close to silence.
License follows the upstream SongGeneration release. Check the official model card and repository for the authoritative model license.
1@misc{songgeneration-mlx,
2 title = {SongGeneration-MLX: Apple MLX port of SongGeneration},
3 author = {ailuntx},
4 year = {2026},
5 url = {https://github.com/ailuntx/SongGeneration-MLX},
6}
7
8@article{lei2025levo,
9 title = {LeVo: High-Quality Song Generation with Multi-Preference Alignment},
10 author = {Lei, Shun and Xu, Yaoxun and Lin, Zhiwei and Zhang, Huaicheng and Tan, Wei and Chen, Hangting and Yu, Jianwei and Zhang, Yixuan and Yang, Chenyu and Zhu, Haina and Wang, Shuai and Wu, Zhiyong and Yu, Dong},
11 journal = {arXiv preprint arXiv:2506.07520},
12 year = {2025},
13}