Downloads · 30 days
0
eigenben/jazz-harmony-embeddings
jazz-harmony-embeddings is a feature extraction model from eigenben. Use it when you need embeddings to search or compare text. It is set up for pytorch. The card lists the license as cc-by-nc-sa-4.0.
A small transformer that reads the chord progression of a jazz tune and returns a single 128-dimensional vector, trained so that tunes with related harmony — transpositions, alternate charts, contrafacts — land close…
Downloads · 30 days
0
Access
Public
Updated Jul 14, 2026
Repo size
17 MB
Likes
0
Public
Click a slice to open those files.
.pt17 MB · 100%
From the Hugging Face model README
A small transformer that reads the chord progression of a jazz tune and returns a single 128-dimensional vector, trained so that tunes with related harmony — transpositions, alternate charts, contrafacts — land close together in the vector space.
Trained from scratch on ~8,000 chord charts. Code, evaluation harness, and full experiment records: https://github.com/eigenben/jazz-harmony-embeddings. Precomputed embeddings for 6,900 jazz standards: https://huggingface.co/datasets/eigenben/jazz-harmony-embeddings.
8,089 chord charts merged from four corpora (iReal Pro "Jazz 1460" community playlist, the Bunks Jazz-Chord-Progressions-Corpus, ChoCo's real-book partition, and the Jazz Harmony Treebank), deduplicated into 4,790 tune-families with family-leakage-safe train/validation/test splits — a tune and its duplicates or contrafacts never straddle a split boundary. Chord symbols only; no melodies, no audio. See the repository's DATA.md for licensing and why the published artifacts exclude Treebank-derived data.
Protocol v2 (documented in
eval/benchmark-policy.md):
model selection used validation loss and a development partition of held-out
test families only; the confirmation partition below was never consulted
during development. The curated contrafact set was consulted during iteration
and is reported as a development benchmark.
Held-out unseen families (confirmation partition, 157 queries): median best-positive rank 1, MRR 0.667, Recall@20 0.677, nDCG@20 0.609.
Curated graded contrafacts (37 queries, development benchmark), vs. classical baselines on the same corpus:
| method | median rank | MRR | Recall@20 | nDCG@20 |
|---|---|---|---|---|
| tf-idf over chord n-grams (B0) | 8 | 0.379 | 0.515 | 0.280 |
| sequence alignment + rerank (B2) | 2 | 0.504 | 0.522 | 0.374 |
| Bunks membrane-area, ISMIR 2023 (B3) | 2 | 0.492 | 0.626 | 0.320 |
| chord2vec + SIF pooling (B4) | 153 | 0.149 | 0.179 | 0.133 |
| this model (3-seed ensemble) | 4 | 0.422 | 0.464 | 0.393 |
Honest summary: the ensemble has the best graded ranking quality (nDCG@20) on the contrafact benchmark but is not uniformly better than the strongest pairwise baselines, which retain a better median rank. What the baselines cannot do is produce a vector space — one point per tune that can be indexed, clustered, and mapped. Transposition invariance, the property the training recipe targets, holds at 99.5% (the same tune transposed to a random key retrieves itself at rank 1 in 995/1000 trials); hierarchical bar/phrase-level variants of this model were also trained and all failed that gate, which is why this simpler flat model is the released one.
The checkpoints are for re-embedding chord charts with the project's tokenizer and schema; if you just want vectors for known jazz standards, use the precomputed dataset instead.
# pip install "jazz-harmony-embeddings @ git+https://github.com/eigenben/jazz-harmony-embeddings"
from huggingface_hub import hf_hub_download
from jazz_harmony_embeddings.models.inference import load_checkpoint, embed_tunes
paths = [
hf_hub_download("eigenben/jazz-harmony-embeddings", f"checkpoints/best-s{seed}.pt")
for seed in (7, 17, 29)
]
models = [load_checkpoint(path)[0] for path in paths]
# tunes: list[jazz_harmony_embeddings.data.schema.Tune]
# ensemble = L2-normalized mean of embed_tunes(model, tunes) across the three models