|
Download README.md from krishnah27/AriaLM: direct link, hf CLI and curl.
- Browser
- Download file 4.17 kB
-
https://huggingface.co/krishnah27/AriaLM/resolve/main/README.md
- Command line
-
hf download hf://krishnah27/AriaLM/README.md
-
curl -L -o README.md https://huggingface.co/krishnah27/AriaLM/resolve/main/README.md
4.17 kB
| license: mit | |
| tags: | |
| - music | |
| - music-generation | |
| - midi | |
| - pytorch | |
| - onnx | |
| - custom | |
| datasets: | |
| - drengskapur/midi-classical-music | |
| pipeline_tag: text-generation | |
| # Music Generation LLM | |
| A LLaMA-style Transformer model for symbolic music generation, trained on MIDI data. | |
| ## Architecture | |
| - **Model**: LLaMA-style Transformer with RoPE, GQA, SwiGLU, RMSNorm | |
| - **Tokenizer**: REMI (REvamped MIDI-derived) β SOTA for symbolic music | |
| - **Dataset**: `drengskapur/midi-classical-music` β 4,796 classical MIDI files (~50MB) | |
| - **Training**: AdamW + Cosine LR warmup + AMP + Gradient Checkpointing | |
| ## Key Features | |
| - **Memory Efficient**: Grouped Query Attention, gradient checkpointing, mixed precision | |
| - **OOM Safe**: Conservative batch sizes, AMP, lazy data loading | |
| - **SOTA Techniques**: RoPE, SwiGLU, RMSNorm, KV-cache, top-p/top-k sampling | |
| ## Quick Start | |
| ```bash | |
| # Install dependencies | |
| pip install -r requirements.txt | |
| # Train + Generate (default) | |
| python3 -m src.s00_main train+generate | |
| # Train only | |
| python3 -m src.s00_main train --epochs 20 --batch-size 4 | |
| # Generate from checkpoint | |
| python3 -m src.s00_main generate --temperature 0.85 | |
| ``` | |
| ## Project Structure | |
| ``` | |
| music_gen_llm/ | |
| βββ src/ | |
| β βββ s00_main.py # Entry point β orchestrates pipeline | |
| β βββ s01_config.py # All configuration dataclasses | |
| β βββ s02_tokenizer.py # REMI MIDI tokenizer | |
| β βββ s03_dataset.py # Data download + tokenization + DataLoader | |
| β βββ s04_model.py # MusicTransformer (LLaMA-style) | |
| β βββ s05_trainer.py # Training loop with AMP + checkpointing | |
| β βββ s06_generator.py # Autoregressive generation with KV-cache | |
| β βββ s07_utils.py # Logging, memory monitoring, seeding | |
| βββ tests/ | |
| β βββ test_pipeline.py # 7 unit tests covering all components | |
| βββ scripts/ | |
| β βββ download_data.sh # Dataset setup | |
| β βββ train.sh # Training launcher | |
| β βββ generate.sh # Generation launcher | |
| βββ docs/ | |
| β βββ README.md # This file | |
| β βββ HLD.md # High-Level Design | |
| β βββ LLD.md # Low-Level Design | |
| β βββ flow_diagram.drawio # Execution flow diagram | |
| βββ data/ # Downloaded MIDI + tokenized cache | |
| βββ checkpoints/ # Saved model weights | |
| βββ output/ # Generated MIDI files | |
| βββ requirements.txt | |
| βββ Dockerfile | |
| βββ .gitignore | |
| ``` | |
| ## Execution Flow | |
| ``` | |
| s00_main.py β s01_config.py β s02_tokenizer.py β s03_dataset.py β s04_model.py β s05_trainer.py β s06_generator.py | |
| β β β β β β β | |
| Entry point Load configs Init tokenizer Download & tokenize Build model Train loop Generate MIDI | |
| ``` | |
| ## Model Specifications | |
| | Parameter | Value | | |
| |---------------|-------------------------------------| | |
| | Dim | 256 | | |
| | Layers | 6 | | |
| | Heads | 8 (Q) / 4 (KV) β GQA | | |
| | Hidden (FFN) | 448 (SwiGLU) | | |
| | Max Seq Len | 1024 | | |
| | Vocab Size | 485 (REMI tokens) | | |
| | Parameters | ~5M | | |
| | Precision | BF16/FP16 (AMP) | | |
| ## Algorithms Used | |
| 1. **Rotary Position Embeddings (RoPE)** β Su et al. 2021 | |
| 2. **Grouped Query Attention (GQA)** β Ainslie et al. 2023, from LLaMA-2 | |
| 3. **SwiGLU Activation** β Shazeer 2020, from LLaMA | |
| 4. **RMS Layer Normalization** β Zhang & Sennrich 2019 | |
| 5. **REMI Tokenization** β Huang & Yang 2020 | |
| 6. **Cosine Annealing with Warmup** β Loshchilov & Hutter 2017 | |
| 7. **Gradient Checkpointing** β Chen et al. 2016 | |
| 8. **KV-Cache** β Standard for efficient autoregressive decoding | |
| 9. **Nucleus (Top-p) + Top-k Sampling** β Holtzman et al. 2020 | |
| 10. **Repetition Penalty** β Keskar et al. 2019 | |