Le Chat Musicien — Transformer decoder-only

MIDI · tokens · modèle GPT · Mozart · génération autorégressive

ISN · Univ. Lille · 2026
Created by Nguyen Duc Hoang Viet
GitHub
Vocabulaire
Tokens après quantisation
93
position · durée · vélocité · hauteur
↑ 4 tokens par note
Architecture
Paramètres du modèle
1,1 M
4 couches · 6 têtes · d_model 192
contexte : 256 tokens
Entraînement
Perte finale
1,48
objectif atteint : < 1,5
↑ 2 époques · AdamW
Génération
Notes par morceau
1 247
5 morceaux générés (seed → .mid)
top-k 50 · top-p 0,85
Sortie du modèle
Piano roll d'un morceau généré (illustration)
Représentation
Une note = 4 tokens
POSITION_480 VELOCITY_80 NOTE_ON_60 DURATION_240
Fonction de coût
Cross-entropy pondérée
POSITION×2,5
NOTE_ON×2
DURATION×2
VELOCITY×1
Chaîne complète
Du fichier MIDI à la musique générée
MIDI→Tokens→vocab.txt→Transformer→Échantillonnage→MIDI
Quantisation : grille de 120 ticks (double-croche) · 9 durées · 8 niveaux de vélocité
Hyperparamètres
Configuration
d_feed-forward768
Dropout0,1
Batch size32
Learning rate3e-4
NormalisationPre-LN
Perspectives
Limites et pistes
Corpus : GrandMidiPiano (Mozart) · Analyse : Nguyen Duc Hoang Viet, Elisa Castano, Yvan Michel Tchonang — Université de Lille, M1 Mathématiques & Applications, 2025–2026
github.com/ndhviet/Projet-Midi-Music-LLM