/ Модель

Характеристики

Лицензия
CC BY-NC 4.0
Опубликована
7 окт 2026

music-llm-45m

Генерация аудиоТекст → аудио

Компактный исследовательский трансформер, генерирующий монофонические музыкальные текстуры по коротким жанровым текстовым запросам.

126скачиваний за 30 дней0лайковвеса обновлены10 окт 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Music-LLM 45M — компактный авторегрессионный трансформер для генерации музыки по коротким текстовым запросам, созданный Khashayar Ghamati. Модель содержит 44,9 млн параметров и реализована на чистом PyTorch; это отдельная архитектура, которую нельзя загрузить через transformers.AutoModel. В качестве ориентира использован дизайн MusicGen, текст кодирует замороженный T5-base, а аудио представляется токенами EnCodec с частотой 32 кГц: четыре кодбука по 2048 токенов при 50 Гц. Декодер состоит из восьми блоков с размерностью 512 и восемью головами внимания.

Модель предназначена для исследовательских и образовательных экспериментов, демонстрирующих полный цикл создания и обучения text-to-music трансформера. Она генерирует монофонические музыкальные текстуры с оттенком жанра, например джаза, металла или классики, но не готовые песни. Обучение проводилось на небольшом наборе GTZAN: около восьми часов аудио и десять жанровых подписей; поэтому управление ограничено простыми жанровыми запросами. Лицензия CC-BY-NC-4.0 допускает использование с указанием авторства и запрещает коммерческое использование.

Сценарии применения

  • создание музыкальной текстуры по запросу «джазовая музыка»
  • генерация короткого музыкального фрагмента в жанре метал
  • демонстрация работы text-to-music трансформера в учебном проекте
  • эксперименты с авторегрессионной генерацией аудиотокенов
  • изучение обучения модели с конвейерным параллелизмом на двух GPU

Ограничения

Модель обучена всего на восьми часах аудио и десяти жанровых подписях, поэтому запросы управляют генерацией грубо, а результат представляет собой текстуру, а не мелодически и структурно завершённую песню. Выход монофонический, с частотой 32 кГц; лицензия запрещает коммерческое использование.

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Music-LLM 45M — a compact text-to-music transformer

A 44.9M-parameter MusicGen-style autoregressive transformer that generates music audio from short text prompts, implemented in pure PyTorch — the attention layers, training loop, generation sampler, and the two-GPU pipeline parallelism it was trained with are all hand-written, without training frameworks.

This model was built for research and education — to demonstrate, end to end, how a text-to-music LLM is constructed and trained. It is a small model (45M parameters, 8 hours of training audio, 10 genre captions), so please do not expect the high-quality music of large production models: it generates genre-flavoured musical texture rather than finished songs. Its value is the fully readable, fully explainable implementation and training story.

Newer version: music-llm-45m-fma is this same architecture, continued from these weights and trained on the Free Music Archive (about 25× more clips, 15 genres).

🔊 Samples

Generated by this exact checkpoint (30 s each, CFG 3.0, top-k 250). Press play:

"jazz music"

"metal music"

"classical music"

Download: jazz · metal · classical

Architecture

Architecture: text prompt through frozen T5 into an 8-block transformer decoder with cross-attention, four 2048-way heads, decoded to audio by frozen EnCodec

componentdetail
audio tokensEnCodec 32 kHz: 4 codebooks × 2048 tokens @ 50 Hz, delay pattern
decoder8 blocks, d=512, 8 heads, pre-LayerNorm, GELU
conditioningfrozen T5-base (768-d) via cross-attention in every block
guidanceclassifier-free guidance (caption dropout 0.2 at train time)
heads4 parallel 2048-way softmax heads, masked cross-entropy
parameters44,876,800 (EnCodec and T5 excluded — frozen, loaded at runtime)

🚀 How to use

Can transformers.AutoModel load this? No — it is a custom architecture, not a transformers model. Instead, everything needed to run it lives in a single file: example.py contains the full model definition and the generation loop, so three commands get you generating:

pip install torch numpy transformers sentencepiece soundfile huggingface_hub
hf download khashayargh/music-llm-45m --local-dir music-llm-45m
cd music-llm-45m && python example.py "jazz music" --seconds 15

(transformers is used only to load the frozen T5 and EnCodec components, which download automatically on first run.)

Trained prompts: "<genre> music" for blues, classical, country, disco, hiphop, jazz, metal, pop, reggae, rock. Runs on CUDA, Apple Silicon (MPS), or CPU; 15 s of audio takes a few minutes on a laptop.

Training

Training and validation loss of the production run

  • Data: GTZAN (999 clips, 10 genres, ~8 h), random 20-second windows
  • Hardware: 2× NVIDIA RTX A6000 via hand-written GPipe-style pipeline parallelism (stage 1: embedding + blocks 1–4; stage 2: blocks 5–8 + heads), 4 micro-batches, valid-token-weighted gradient accumulation with test-proven exact parity to single-device training
  • Recipe: AdamW, peak lr ≈ 5e-4 (Optuna TPE search run through the real pipeline under the production lr schedule), 1000-step warmup + cosine decay, gradient clipping, non-finite-step guard
  • This checkpoint: step 4,000 — the validation-loss minimum (val ≈ 5.98), saved automatically before the train/val curves diverged (early stopping against overfitting on the small corpus)
  • War story: the first runs produced infinite gradients that were root-caused to silent PCIe peer-to-peer corruption on the host machine; the pipeline detects this at startup and reroutes its stage boundary through CPU memory at ~0.3% overhead. Hardware-level debugging is part of distributed training.

Limitations

  • Small model, small data — by design. Education-scale: expect texture and genre flavour, not melody, structure, or production quality
  • Trained on 10 captions total ("blues music" … "rock music") — it cannot follow free-form descriptions; prompt steering is coarse
  • GTZAN-derived: research / educational use only (hence CC-BY-NC-4.0)
  • Mono, 32 kHz

Project

Built by Khashayar Ghamati. The full story — architecture, the two-GPU pipeline, the PCIe bug hunt, real training curves, and audio to judge: Building a Small Transformer That Makes Music

Citation

If you use this model, please cite it:

@misc{ghamati2026musicllm,
  author       = {Ghamati, Khashayar},
  title        = {Music-LLM 45M: a compact text-to-music transformer},
  year         = {2026},
  publisher    = {Hugging Face},
  doi          = {10.57967/hf/10847},
  url          = {https://huggingface.co/khashayargh/music-llm-45m},
  howpublished = {\url{https://huggingface.co/khashayargh/music-llm-45m}},
  note         = {Model weights and inference script. Write-up: \url{https://ghamati.com/blog/music-llm/}}
}

Built on

This model uses and builds on the following work; please credit it too:

  • MusicGen (design reference): Copet et al., Simple and Controllable Music Generation, NeurIPS 2023. arXiv:2306.05284
  • EnCodec (frozen audio codec): Défossez et al., High Fidelity Neural Audio Compression, 2022. arXiv:2210.13438
  • T5 (frozen text encoder): Raffel et al., Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer, JMLR 2020. arXiv:1910.10683
  • GPipe (pipeline-parallel training scheme): Huang et al., GPipe: Efficient Training of Giant Neural Networks using Pipeline Parallelism, NeurIPS 2019. arXiv:1811.06965
  • GTZAN (training data): Tzanetakis and Cook, Musical genre classification of audio signals, IEEE Transactions on Speech and Audio Processing, 10(5), 2002.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм

Нельзя запустить

Архитектура ? неизвестна transformers в образе рантайма.

Ревизия весов
4697352

0 моделей