You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

DM-AMT-Looped V2 (DangerLabs/dm-amt-looped)

Bicameral Hemisphere Surgery: Looped Anticipatory Music Transformer Γ— DM-JEPA 1.7 (Trained on Official Lakh MIDI Split)

DangerLabs/dm-amt-looped surgically fuses two pretrained DangerLabs models into a single 1.07B-parameter bicameral recurrent-looped architecture where DM-JEPA 1.7 guides and controls the looped core in latent space:

  • Left Hemisphere (Generative / Sequential Execution): DangerLabs/music-large-800k-looped (LoopedGPT2LMHeadModel, 780M params, d_L = 1280, 9 prelude / 18 looped core / 9 coda, 55,030 AMT vocabulary).
  • Right Hemisphere (Latent-Space Guidance, Energy Monitoring & Loop Control): DangerLabs/dm-jepa-1.7 (DMBertBackbone17 16 Block-Butterfly layers + AdaptiveEnergyPredictor17 6-step thought-space predictor + RiemannianManifoldScorer metric + HJEPAAbstractProjection, d_R = 1536), switched to strictly causal attention (is_causal=True) for zero future leakage during autoregressive modeling.
  • Corpus Callosum & JEPA Loop Controller (V2):
    1. Pre-Core Right Hemisphere + Mid-Core FiLM Modulation: On every pass p, DM-JEPA advances z_R^{(p)} before the 18-layer Left core executes and modulates internal activations via zero-initialized FiLM/AdaLN taps (1 + g_guide Β· tanh(Ξ³)) Β· h + g_guide Β· Ξ² at global GPT-2 layers 9, 15, and 21.
    2. Channel-Wise Gating ([B, T, 1280]): JEPALoopControllerV2 emits per-channel g_loop and g_guide gates alongside a scalar p_halt so DM-JEPA steers harmonic/structural subspaces independently of local 10 ms timing syntax.
    3. Anti-Collapse Multi-Horizon JEPA: Uses an EMA target encoder (Ο„ = 0.996), three causal latent prediction horizons (t+3 next note, t+12 next beat/chord, t+24 next phrase), and a VICReg-style variance floor (relu(1 - std(z))).
    4. Differentiable PonderNet / ACT Geometric Halting: Trains p_halt directly via geometric halting weights over per-pass LM losses + KL ponder prior (p_prior = 0.35).
    5. Zero-Init Pass Embeddings: Learned pass_emb_left and pass_emb_right let shared core weights specialize across draft β†’ refine β†’ polish passes.

Checkpoint Format: bicameral_v2_lakh_delta.safetensors stores all 463 trained surgical delta tensors (Corpus Callosum, Channel-wise Controller, Mid-Core FiLM taps, Multi-Horizon JEPA heads, Pass Embeddings, 6-step JEPA Predictor, Riemannian Metric, H-JEPA L2, Dual-Hemisphere rank-16 LoRA adapters, and EMA targets) applied on top of DangerLabs/music-large-800k-looped and DangerLabs/dm-jepa-1.7.


Single-Instrument Monophonic Melody Samples (Vanilla music-large-800k vs. DM-AMT-Looped V2)

Side-by-side 40-note single-instrument monophonic melodies (8-note motif prompt β†’ 32 generated melody notes via model.generate_melody(..., monophonic=True, num_passes=3), temperature=0.90, top_p=0.92, identical seed):

Melody Prompt (Instrument) Vanilla stanford-crfm/music-large-800k DM-AMT-Looped V2 (num_passes=3)
01. Progressive House Lead (Supersaw inst=81)
MP3 Β· MIDI

MP3 Β· MIDI
02. Melodic Techno Pluck (Square Lead inst=80)
MP3 Β· MIDI

MP3 Β· MIDI
03. Uplifting Trance Lead (Sawtooth Lead inst=81)
MP3 Β· MIDI

MP3 Β· MIDI
04. Piano Topline (Acoustic Grand Piano inst=0)
MP3 Β· MIDI

MP3 Β· MIDI

Training Curriculum (Official Lakh MIDI Split)

Trained on the exact official Lakh MIDI (lmd_full) MD5 split used by stanford-crfm/music-large-800k (Thickstun et al., TMLR 2024, arXiv:2306.08620 Appendix E):

  • Train: MD5 leading hex 0–d (16,785 multi-instrument sequences Γ— 385 tokens = 6.46M tokens)
  • Validation: MD5 leading hex e (1,678 sequences)
  • Test: MD5 leading hex f (1,703 sequences)

Trained on a single NVIDIA GB10 GPU with gradient checkpointing (~4.5–7 GB VRAM even at num_passes=6 / 148 effective layers):

  • Stage 1 (100 steps, lr=1e-3, 12.1M params): Hemisphere alignment (Corpus Callosum, Channel-wise Controller, Mid-Core FiLM taps, Multi-Horizon JEPA heads, Pass Embeddings).
  • Stage 2 (220 steps, lr=2e-4, 136.6M params): Recurrent depth ramp (Uniform(2, 4) β†’ Uniform(2, 6) up to 148 effective layers) unfreezing the 6-step DM-JEPA predictor, Riemannian metric, H-JEPA L2, and rank-16 LoRA on both hemispheres.

Benchmarks vs. Vanilla stanford-crfm/music-large-800k

1. 10-Track Multi-Instrument EDM Benchmark (Drums + Synths + Bass + Pads)

DM-AMT-Looped V2 beats vanilla stanford-crfm/music-large-800k across EVERY token category (Time, Duration, Melodic Notes, and Drums) and wins 8/10 multi-track EDM tracks (and 10/10 on the Right-Hemisphere Guidance ON vs. OFF ablation!):

Model / Config Mean NLL Mean PPL Time NLL Duration NLL Melodic Note NLL Drum (inst=128) NLL
Vanilla music-large-800k 0.2877 1.333 0.1766 0.3011 0.5590 0.1110
DM-AMT-Looped V2 (p=1, 53L) 0.2750 1.317 0.1567 0.2957 0.5409 0.1066
DM-AMT-Looped V2 (p=2, 72L) 0.2760 1.318 0.1580 0.2960 0.5439 0.1055
DM-AMT-Looped V2 (p=4, 110L) 0.2783 1.321 0.1601 0.2980 0.5482 0.1061
DM-AMT-Looped V2 (p=6, 148L) 0.2814 1.325 0.1626 0.3005 0.5529 0.1072
DM-AMT-Looped V2 (Adaptive Halt) 0.2770 1.319 0.1591 0.2970 0.5451 0.1058
Ablation: V2 p=4 Guidance OFF 0.2840 1.328 0.1670 0.3002 0.5579 0.1113
  • Right-Hemisphere Causal Gain on Multi-Track EDM (p=4): +0.0057 nats (0.2840 OFF β†’ 0.2783 ON, positive on 10/10 tracks!).
  • Single-Instrument (inst=0) 10-Track EDM: V2 (p=3) also beats vanilla (0.2875 vs. 0.2917, βˆ’0.0042 nats, winning 7/10 tracks).

Per-Track 10-EDM NLL Comparison

EDM Track Vanilla (Multi-Track) V2 p=1 (Multi) V2 p=4 (Multi) Ablation p=4 OFF Vanilla (Single-Inst) V2 p=3 (Single-Inst)
01_progressive_house 0.2197 0.2096 0.2129 0.2183 0.2658 0.2642
02_big_room_drop 0.2880 0.2808 0.2849 0.2938 0.3113 0.3126
03_future_bass 0.3195 0.3064 0.3083 0.3136 0.3154 0.3135
04_melodic_techno 0.2307 0.2319 0.2334 0.2351 0.2227 0.2311
05_acid_303_techno 0.4762 0.4379 0.4498 0.4597 0.4372 0.4248
06_drum_and_bass 0.3822 0.3738 0.3784 0.3839 0.3764 0.3620
07_uplifting_trance 0.2117 0.1982 0.2008 0.2089 0.2178 0.2064
08_deep_house_groove 0.2556 0.2436 0.2428 0.2465 0.2552 0.2519
09_dubstep_halftime 0.2531 0.2271 0.2293 0.2369 0.2697 0.2546
10_synthwave_electro 0.2402 0.2408 0.2425 0.2433 0.2458 0.2534
Mean (10 Tracks) 0.2877 0.2750 0.2783 0.2840 0.2917 0.2875

2. Official Lakh MIDI Held-Out Test Split (hash f, 64 Sequences Γ— 385 Tokens)

Model / Pass Config Eff. Layers Lakh Test NLL Lakh Test PPL Right-Hemisphere Ablation (OFF β†’ ON) JEPA Loss / Var Loss p_halt
Vanilla music-large-800k 36 0.9632 2.620 β€” β€” β€”
DM-AMT-Looped V2 (p=1) 53 0.9641 2.623 +0.0140 nats (0.9781 β†’ 0.9641) 0.4065 / 0.0644 0.441
DM-AMT-Looped V2 (p=2) 72 0.9640 2.622 +0.0141 nats (0.9781 β†’ 0.9640) 0.4053 / 0.0602 0.506
DM-AMT-Looped V2 (p=3) 91 0.9648 2.624 +0.0144 nats (0.9792 β†’ 0.9648) 0.4057 / 0.0597 0.556
DM-AMT-Looped V2 (p=4) 110 0.9663 2.628 +0.0147 nats (0.9810 β†’ 0.9663) 0.4066 / 0.0605 0.589
DM-AMT-Looped V2 (p=6) 148 0.9714 2.642 +0.0146 nats (0.9860 β†’ 0.9714) 0.4091 / 0.0652 0.590

Adaptive Halting on Official Lakh Test (hash f):

  • thr=0.45: 2.00 avg passes, 287.0 ms/batch, NLL = 0.9640 (1.91Γ— faster than thr=0.60's 5.06 avg passes at 547.0 ms/batch!).
  • Compared to the untrained bicameral baseline at p=6 (NLL = 0.9948), Lakh training cut deep-pass NLL by βˆ’0.0234 nats while keeping JEPA alignment healthy (0.405, var = 0.060).

Quickstart Usage

import torch
from safetensors.torch import load_file
from bicameral_looped_amt_v2 import BicameralLoopedAMTV2

# 1. Load both pretrained hemispheres
model = BicameralLoopedAMTV2.from_pretrained_hemispheres(
    amt_path="DangerLabs/music-large-800k-looped",
    jepa_safetensors="/path/to/dm-jepa-1.7/model.safetensors",
    dtype=torch.bfloat16,
    device="cuda",
)

# 2. Attach LoRA structure & load trained Lakh V2 delta weights
model.configure_stage2_recurrent_lora(r=16, alpha=32.0)
delta = load_file("bicameral_v2_lakh_delta.safetensors", device="cuda")
model.load_state_dict(delta, strict=False)
model.eval()

# 3. Run bicameral forward pass with DM-JEPA guidance & adaptive halting
input_ids = torch.tensor([[55025, 0, 10050, 11060, 50, 10040, 11064]], device="cuda")
with torch.no_grad():
    out = model(input_ids, num_passes=6, adaptive_halt=True, halt_threshold=0.45, min_passes=2)
    print("Executed passes:", out.executed_passes, "Logits:", tuple(out.logits.shape))

# 4. Generate any single lane (melodic, rhythmic, or hybrid: 808 slides, acid 303, trance arp, topline)
# Example A: F-minor 140 BPM 808 slide lane (legato_slide allows glide overlaps)
bass_808 = model.generate_lane(
    prompt=input_ids,
    new_events=32,
    instrument=39,             # Synth/808 Bass (38/39), Square Lead (80), Saw Lead (81), Piano (0), Drums (128)
    lane_mode="legato_slide",  # "monophonic" | "legato_slide" | "polyphonic"
    key="F",
    scale="minor",             # major, minor, dorian, phrygian, harmonic_minor, pentatonic_minor, blues, chromatic
    bpm=140,
    grid="1/16",               # "1/4", "1/8", "1/16", "1/8T", "1/16T", or None (free)
    swing=0.0,
    pitch_range=(29, 53),
    dur_range=(15, 90),
    num_passes=3,              # or adaptive_halt=True
)
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for DangerLabs/dm-amt-looped

Finetuned
(1)
this model

Paper for DangerLabs/dm-amt-looped