Night 10.11.2026: m-a-p/SheetSage2 (the transcriber as m-a-p publishes it), unchanged (CC BY-NC 4.0), at the Studio's own path; its lines in MANIFEST.tsv, SHA256SUMS, THIRD_PARTY_NOTICES.md and the card
Browse filesFiles changed (10)
- MANIFEST.tsv+8
- SHA256SUMS+8
- checkpoints/SheetSage2/README.mdAdded+234
- checkpoints/SheetSage2/benchmark_results.jsonAdded+464
- checkpoints/SheetSage2/benchmarks/jaah.mdAdded+38
- checkpoints/SheetSage2/benchmarks/jaah_per_song.csvAdded
- checkpoints/SheetSage2/benchmarks/jaah_results.jsonAdded+219
- checkpoints/SheetSage2/benchmarks/jaah_statistics.jsonAdded+62
- checkpoints/SheetSage2/modeling_sheetsage2.pyAdded+448
- checkpoints/SheetSage2/processing_sheetsage2.pyAdded+109
189 unmodified lines19019119219319419519619719819920020120211 unmodified lines214215216217218219220221189 unmodified linescheckpoints/Qwopus3.5-9B-GGUF/Qwopus3.5-9B-v3-AR-Q4_0.gguf 6675391200 c08446f78bc33564f3340baa2310d6a79423165f9ef365b1766373818fff038e - Jackrong/Qwopus3.5-9B-v3 (a fine-tune of Qwen/Qwen3.5-9B), quantized for Ruach Studio with AutoRound (W4A16, symmetric, group 32) and moved into GGUF bit for bit, text only: quality Q4_0 + Q8_0, compact Q4_0 + Q4_K/Q5_K/Q6_K Apache-2.0checkpoints/Qwopus3.5-9B-GGUF/Qwopus3.5-9B-v3-AR-compact.gguf 5467513568 b440b8a2162a292d225c3585863122e9eb0afffa3b9f390e66384a878b3823e7 - Jackrong/Qwopus3.5-9B-v3 (a fine-tune of Qwen/Qwen3.5-9B), quantized for Ruach Studio with AutoRound (W4A16, symmetric, group 32) and moved into GGUF bit for bit, text only: quality Q4_0 + Q8_0, compact Q4_0 + Q4_K/Q5_K/Q6_K Apache-2.0checkpoints/SheetSage2/LICENSE 20000 73593d6cad4ca80f3ab1448a4908f92ab802dfffe029561e3b12fa7d07c8b87c - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/THIRD_PARTY_NOTICES.md 589 ab8b195c2c1475f254a04181a9841db2f2581c579b95858c78ee0040eb495a29 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/__init__.py 39 19539a965cabf22d08231688efc15547d005e6345745f48684c2f02d010f82fd - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/assets/architecture.png 310767 4ca7396e9a7055f6824607f17c644dd59f3c28097c6adf10ee30c19056f998ef - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/audio_sheetsage2.py 4289 ecce56e7bb8a08cbca9eb27a74d9aeff17f55e80efcc7c48f7436440f610ccc1 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/chordformer.md 3911 1365cce20f90d8ff7883864426442061dced12786c7484b63e2805e5bd57c609 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/chordformer_per_song.csv 403258 b82e957f766da5d6522207485b172c0f7f5f05dcb4946c13578c2078a42e579a - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/chordformer_results.json 4440 18d2acba5b9a1103a3cb47f04e41d29c9233bcf4db647a0e6d262d0df2b7118f - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/rock_corpus.md 1754 4209bf4c654a27904ca59855cb3470bb2b28dd9da30e9e27f0d398a9ada7a261 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/rock_corpus_per_song.csv 38285 4826dc875906b05a2509916e5e5092655e8ff8e31763f87a45db6ca69b3156cf - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/rock_corpus_results.json 1141 e1384d023cf8528b181f923e188dd3d7faeefd1102c8b97e3c7fe1e29614bbcb - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.011 unmodified linescheckpoints/SheetSage2/midi_sheetsage2.py 4230 32f80d13592c669e56683ebb4c415f13bf8278c8ad1fe43afa500347bed35099 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/model.safetensors 228738564 b235f68091a5f5b644000f2b5acb57d1e70432aca2b34ab1b9cf27236e1f4274 445066f8edbc52ef21254023a971eeb528d31c29190073d6ae654e1db573998d m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/modeling_mert2.py 17081 b1a3174e5649c4b26b0c90d8626f0adacfbbba111a58ed3bb72ad651945a2f5c - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/notation_sheetsage2.py 55775 f75f0e8b268cd9e9c622d791d3fd77d2e68ad355a4e67018c7e15aeb2bc05af7 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/pipeline_sheetsage2.py 15022 0ae572554ca375323e2aa4ea1fb25ba27e7f4d520c0ba5b101d74930c0a66c33 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/processor_config.json 277 1eed73513a74029fe74c71faba70f8cff002ae7be23ac1c926125846d1b29817 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render.py 1927 446b18e0ba7250c8584c14bda241f8d063083cd10b1432de82c3cf56736af9de - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/DejaVuSans.ttf 757076 7da195a74c55bef988d0d48f9508bd5d849425c1770dba5d7bfc6ce9ed848954 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0189 unmodified lines19019119219319419519619719819920020120220320420520620720811 unmodified lines220221222223224225226227228229189 unmodified linescheckpoints/Qwopus3.5-9B-GGUF/Qwopus3.5-9B-v3-AR-Q4_0.gguf 6675391200 c08446f78bc33564f3340baa2310d6a79423165f9ef365b1766373818fff038e - Jackrong/Qwopus3.5-9B-v3 (a fine-tune of Qwen/Qwen3.5-9B), quantized for Ruach Studio with AutoRound (W4A16, symmetric, group 32) and moved into GGUF bit for bit, text only: quality Q4_0 + Q8_0, compact Q4_0 + Q4_K/Q5_K/Q6_K Apache-2.0checkpoints/Qwopus3.5-9B-GGUF/Qwopus3.5-9B-v3-AR-compact.gguf 5467513568 b440b8a2162a292d225c3585863122e9eb0afffa3b9f390e66384a878b3823e7 - Jackrong/Qwopus3.5-9B-v3 (a fine-tune of Qwen/Qwen3.5-9B), quantized for Ruach Studio with AutoRound (W4A16, symmetric, group 32) and moved into GGUF bit for bit, text only: quality Q4_0 + Q8_0, compact Q4_0 + Q4_K/Q5_K/Q6_K Apache-2.0checkpoints/SheetSage2/LICENSE 20000 73593d6cad4ca80f3ab1448a4908f92ab802dfffe029561e3b12fa7d07c8b87c - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/README.md 14919 140afd17ce927970c52ff7ff3486f6128bf481842ae9c525e8931180b35884c3 - m-a-p/SheetSage2 (an earlier revision, as the Studio holds it) CC BY-NC 4.0checkpoints/SheetSage2/THIRD_PARTY_NOTICES.md 589 ab8b195c2c1475f254a04181a9841db2f2581c579b95858c78ee0040eb495a29 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/__init__.py 39 19539a965cabf22d08231688efc15547d005e6345745f48684c2f02d010f82fd - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/assets/architecture.png 310767 4ca7396e9a7055f6824607f17c644dd59f3c28097c6adf10ee30c19056f998ef - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/audio_sheetsage2.py 4289 ecce56e7bb8a08cbca9eb27a74d9aeff17f55e80efcc7c48f7436440f610ccc1 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmark_results.json 12330 6a96828d333824c53ffd4b10c06a4565c4582dad01eb06fa328508f9db2b8ab1 - m-a-p/SheetSage2 (an earlier revision, as the Studio holds it) CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/chordformer.md 3911 1365cce20f90d8ff7883864426442061dced12786c7484b63e2805e5bd57c609 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/chordformer_per_song.csv 403258 b82e957f766da5d6522207485b172c0f7f5f05dcb4946c13578c2078a42e579a - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/chordformer_results.json 4440 18d2acba5b9a1103a3cb47f04e41d29c9233bcf4db647a0e6d262d0df2b7118f - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/jaah.md 5007 a78cd28824386285c9dfc9e1ae51d822a57ca97eb0a76167469118cf95618eff - m-a-p/SheetSage2 (an earlier revision, as the Studio holds it) CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/jaah_per_song.csv 183723 e07fac3cfcb7e404b9dce97f755f88fb7e4b05a014c69c3a64c938c590d4e1b9 - m-a-p/SheetSage2 (an earlier revision, as the Studio holds it) CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/jaah_results.json 7118 ca08fc5197edc27ad3711f70d874bb1e4cd293eb83477bbcf50f85666a6ac7ec - m-a-p/SheetSage2 (an earlier revision, as the Studio holds it) CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/jaah_statistics.json 1417 a74a193d1d35305e9292838ecb0dc07f245016c16fe0fcf76084f75e485d610d - m-a-p/SheetSage2 (an earlier revision, as the Studio holds it) CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/rock_corpus.md 1754 4209bf4c654a27904ca59855cb3470bb2b28dd9da30e9e27f0d398a9ada7a261 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/rock_corpus_per_song.csv 38285 4826dc875906b05a2509916e5e5092655e8ff8e31763f87a45db6ca69b3156cf - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/rock_corpus_results.json 1141 e1384d023cf8528b181f923e188dd3d7faeefd1102c8b97e3c7fe1e29614bbcb - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.011 unmodified linescheckpoints/SheetSage2/midi_sheetsage2.py 4230 32f80d13592c669e56683ebb4c415f13bf8278c8ad1fe43afa500347bed35099 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/model.safetensors 228738564 b235f68091a5f5b644000f2b5acb57d1e70432aca2b34ab1b9cf27236e1f4274 445066f8edbc52ef21254023a971eeb528d31c29190073d6ae654e1db573998d m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/modeling_mert2.py 17081 b1a3174e5649c4b26b0c90d8626f0adacfbbba111a58ed3bb72ad651945a2f5c - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/modeling_sheetsage2.py 24602 df36bec866e4bd1f0a08e79369405c9a1bd86214a1c48559e75e3e567f43bbc4 - m-a-p/SheetSage2 (an earlier revision, as the Studio holds it) CC BY-NC 4.0checkpoints/SheetSage2/notation_sheetsage2.py 55775 f75f0e8b268cd9e9c622d791d3fd77d2e68ad355a4e67018c7e15aeb2bc05af7 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/pipeline_sheetsage2.py 15022 0ae572554ca375323e2aa4ea1fb25ba27e7f4d520c0ba5b101d74930c0a66c33 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/processing_sheetsage2.py 5346 b8dfa9f344ea7efab3ac9ec61f4c3bd0345f7a65d39a5c2c8b8a803689fdc393 - m-a-p/SheetSage2 (an earlier revision, as the Studio holds it) CC BY-NC 4.0checkpoints/SheetSage2/processor_config.json 277 1eed73513a74029fe74c71faba70f8cff002ae7be23ac1c926125846d1b29817 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render.py 1927 446b18e0ba7250c8584c14bda241f8d063083cd10b1432de82c3cf56736af9de - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/DejaVuSans.ttf 757076 7da195a74c55bef988d0d48f9508bd5d849425c1770dba5d7bfc6ce9ed848954 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0
185 unmodified lines18618718818919019119219319419519619719811 unmodified lines210211212213214215216217185 unmodified lines569aa7a9171e36dfff80f0a7550ab0c9c09e46ac840fea5030641417394fb0d2 checkpoints/Qwen2.5-Omni-7B/tokenizer_config.jsonca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910 checkpoints/Qwen2.5-Omni-7B/vocab.json73593d6cad4ca80f3ab1448a4908f92ab802dfffe029561e3b12fa7d07c8b87c checkpoints/SheetSage2/LICENSEab8b195c2c1475f254a04181a9841db2f2581c579b95858c78ee0040eb495a29 checkpoints/SheetSage2/THIRD_PARTY_NOTICES.md19539a965cabf22d08231688efc15547d005e6345745f48684c2f02d010f82fd checkpoints/SheetSage2/__init__.py4ca7396e9a7055f6824607f17c644dd59f3c28097c6adf10ee30c19056f998ef checkpoints/SheetSage2/assets/architecture.pngecce56e7bb8a08cbca9eb27a74d9aeff17f55e80efcc7c48f7436440f610ccc1 checkpoints/SheetSage2/audio_sheetsage2.py1365cce20f90d8ff7883864426442061dced12786c7484b63e2805e5bd57c609 checkpoints/SheetSage2/benchmarks/chordformer.mdb82e957f766da5d6522207485b172c0f7f5f05dcb4946c13578c2078a42e579a checkpoints/SheetSage2/benchmarks/chordformer_per_song.csv18d2acba5b9a1103a3cb47f04e41d29c9233bcf4db647a0e6d262d0df2b7118f checkpoints/SheetSage2/benchmarks/chordformer_results.json4209bf4c654a27904ca59855cb3470bb2b28dd9da30e9e27f0d398a9ada7a261 checkpoints/SheetSage2/benchmarks/rock_corpus.md4826dc875906b05a2509916e5e5092655e8ff8e31763f87a45db6ca69b3156cf checkpoints/SheetSage2/benchmarks/rock_corpus_per_song.csve1384d023cf8528b181f923e188dd3d7faeefd1102c8b97e3c7fe1e29614bbcb checkpoints/SheetSage2/benchmarks/rock_corpus_results.json11 unmodified lines32f80d13592c669e56683ebb4c415f13bf8278c8ad1fe43afa500347bed35099 checkpoints/SheetSage2/midi_sheetsage2.pyb235f68091a5f5b644000f2b5acb57d1e70432aca2b34ab1b9cf27236e1f4274 checkpoints/SheetSage2/model.safetensorsb1a3174e5649c4b26b0c90d8626f0adacfbbba111a58ed3bb72ad651945a2f5c checkpoints/SheetSage2/modeling_mert2.pyf75f0e8b268cd9e9c622d791d3fd77d2e68ad355a4e67018c7e15aeb2bc05af7 checkpoints/SheetSage2/notation_sheetsage2.py0ae572554ca375323e2aa4ea1fb25ba27e7f4d520c0ba5b101d74930c0a66c33 checkpoints/SheetSage2/pipeline_sheetsage2.py1eed73513a74029fe74c71faba70f8cff002ae7be23ac1c926125846d1b29817 checkpoints/SheetSage2/processor_config.json446b18e0ba7250c8584c14bda241f8d063083cd10b1432de82c3cf56736af9de checkpoints/SheetSage2/render.py7da195a74c55bef988d0d48f9508bd5d849425c1770dba5d7bfc6ce9ed848954 checkpoints/SheetSage2/render_assets/DejaVuSans.ttf185 unmodified lines18618718818919019119219319419519619719819920020120220320411 unmodified lines216217218219220221222223224225185 unmodified lines569aa7a9171e36dfff80f0a7550ab0c9c09e46ac840fea5030641417394fb0d2 checkpoints/Qwen2.5-Omni-7B/tokenizer_config.jsonca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910 checkpoints/Qwen2.5-Omni-7B/vocab.json73593d6cad4ca80f3ab1448a4908f92ab802dfffe029561e3b12fa7d07c8b87c checkpoints/SheetSage2/LICENSE140afd17ce927970c52ff7ff3486f6128bf481842ae9c525e8931180b35884c3 checkpoints/SheetSage2/README.mdab8b195c2c1475f254a04181a9841db2f2581c579b95858c78ee0040eb495a29 checkpoints/SheetSage2/THIRD_PARTY_NOTICES.md19539a965cabf22d08231688efc15547d005e6345745f48684c2f02d010f82fd checkpoints/SheetSage2/__init__.py4ca7396e9a7055f6824607f17c644dd59f3c28097c6adf10ee30c19056f998ef checkpoints/SheetSage2/assets/architecture.pngecce56e7bb8a08cbca9eb27a74d9aeff17f55e80efcc7c48f7436440f610ccc1 checkpoints/SheetSage2/audio_sheetsage2.py6a96828d333824c53ffd4b10c06a4565c4582dad01eb06fa328508f9db2b8ab1 checkpoints/SheetSage2/benchmark_results.json1365cce20f90d8ff7883864426442061dced12786c7484b63e2805e5bd57c609 checkpoints/SheetSage2/benchmarks/chordformer.mdb82e957f766da5d6522207485b172c0f7f5f05dcb4946c13578c2078a42e579a checkpoints/SheetSage2/benchmarks/chordformer_per_song.csv18d2acba5b9a1103a3cb47f04e41d29c9233bcf4db647a0e6d262d0df2b7118f checkpoints/SheetSage2/benchmarks/chordformer_results.jsona78cd28824386285c9dfc9e1ae51d822a57ca97eb0a76167469118cf95618eff checkpoints/SheetSage2/benchmarks/jaah.mde07fac3cfcb7e404b9dce97f755f88fb7e4b05a014c69c3a64c938c590d4e1b9 checkpoints/SheetSage2/benchmarks/jaah_per_song.csvca08fc5197edc27ad3711f70d874bb1e4cd293eb83477bbcf50f85666a6ac7ec checkpoints/SheetSage2/benchmarks/jaah_results.jsona74a193d1d35305e9292838ecb0dc07f245016c16fe0fcf76084f75e485d610d checkpoints/SheetSage2/benchmarks/jaah_statistics.json4209bf4c654a27904ca59855cb3470bb2b28dd9da30e9e27f0d398a9ada7a261 checkpoints/SheetSage2/benchmarks/rock_corpus.md4826dc875906b05a2509916e5e5092655e8ff8e31763f87a45db6ca69b3156cf checkpoints/SheetSage2/benchmarks/rock_corpus_per_song.csve1384d023cf8528b181f923e188dd3d7faeefd1102c8b97e3c7fe1e29614bbcb checkpoints/SheetSage2/benchmarks/rock_corpus_results.json11 unmodified lines32f80d13592c669e56683ebb4c415f13bf8278c8ad1fe43afa500347bed35099 checkpoints/SheetSage2/midi_sheetsage2.pyb235f68091a5f5b644000f2b5acb57d1e70432aca2b34ab1b9cf27236e1f4274 checkpoints/SheetSage2/model.safetensorsb1a3174e5649c4b26b0c90d8626f0adacfbbba111a58ed3bb72ad651945a2f5c checkpoints/SheetSage2/modeling_mert2.pydf36bec866e4bd1f0a08e79369405c9a1bd86214a1c48559e75e3e567f43bbc4 checkpoints/SheetSage2/modeling_sheetsage2.pyf75f0e8b268cd9e9c622d791d3fd77d2e68ad355a4e67018c7e15aeb2bc05af7 checkpoints/SheetSage2/notation_sheetsage2.py0ae572554ca375323e2aa4ea1fb25ba27e7f4d520c0ba5b101d74930c0a66c33 checkpoints/SheetSage2/pipeline_sheetsage2.pyb8dfa9f344ea7efab3ac9ec61f4c3bd0345f7a65d39a5c2c8b8a803689fdc393 checkpoints/SheetSage2/processing_sheetsage2.py1eed73513a74029fe74c71faba70f8cff002ae7be23ac1c926125846d1b29817 checkpoints/SheetSage2/processor_config.json446b18e0ba7250c8584c14bda241f8d063083cd10b1432de82c3cf56736af9de checkpoints/SheetSage2/render.py7da195a74c55bef988d0d48f9508bd5d849425c1770dba5d7bfc6ce9ed848954 checkpoints/SheetSage2/render_assets/DejaVuSans.ttf
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234---license: cc-by-nc-4.0library_name: transformersbase_model: m-a-p/MERT-v2-FullSongbase_model_relation: adaptertags:- audio- music- music-transcription- midi- abc-notation- custom_code---<h1 align="center">🤗 SheetSage2</h1><p align="center"><strong>Music audio to editable scores</strong></p><p align="center">Melody · Chords · Beats · Key · Structure</p>
<p align="center"> <a href="https://map-yue2.github.io/">🎵 YuE2 project</a> · <a href="#quick-start">🚀 Quick start</a> · <a href="#benchmarks">📊 Benchmarks</a> · <a href="#citation">📚 Citation</a></p><p align="center"> <a href="https://huggingface.co/m-a-p/YuE2-3B"><img alt="🤗 YuE2-3B" src="https://img.shields.io/badge/YuE2--3B-374151?logo=huggingface&logoColor=FFD21E" height="20" /></a> <a href="https://huggingface.co/m-a-p/YuE2-Vae"><img alt="🤗 YuE2-Vae" src="https://img.shields.io/badge/YuE2--Vae-374151?logo=huggingface&logoColor=FFD21E" height="20" /></a> <a href="https://huggingface.co/m-a-p/YuE2-Vae-legacy"><img alt="🤗 YuE2-Vae-legacy" src="https://img.shields.io/badge/YuE2--Vae--legacy-374151?logo=huggingface&logoColor=FFD21E" height="20" /></a> <a href="https://huggingface.co/m-a-p/MERT-v2-30s"><img alt="🤗 MERT-v2-30s" src="https://img.shields.io/badge/MERT--v2--30s-374151?logo=huggingface&logoColor=FFD21E" height="20" /></a> <a href="https://huggingface.co/m-a-p/MERT-v2-FullSong"><img alt="🤗 MERT-v2-FullSong" src="https://img.shields.io/badge/MERT--v2--FullSong-374151?logo=huggingface&logoColor=FFD21E" height="20" /></a> <a href="https://huggingface.co/datasets/m-a-p/WildSongBench"><img alt="🤗 WildSongBench" src="https://img.shields.io/badge/WildSongBench-374151?logo=huggingface&logoColor=FFD21E" height="20" /></a> <a href="https://huggingface.co/m-a-p/SheetSage2"><img alt="SheetSage2" src="https://img.shields.io/badge/SheetSage2-374151?logo=huggingface&logoColor=FFD21E" height="20" /></a></p>
**SheetSage2 turns music recordings into lead sheets and timed musical annotations.** Transcribe a complete song, edit its ABC or MIDI, render a piano preview, or extract embeddings and token predictions for your own tools.
Built on [MERT-v2-FullSong](https://huggingface.co/m-a-p/MERT-v2-FullSong), with adapters that merge automatically when you load the model.

**Update log:**
**2026-09-24:** Fixed a bug in key-aware chord spelling. Candidate chord tones were spelled incorrectly, which favored sharp-side names for chromatic chords (e.g., `B#` instead of `C` in E major, `A#` instead of `Bb` in G major). Only chord label names change; pitches, timing, key labels, and model weights are unchanged.
**2026-09-21:** Fixed missing enharmonic spelling correction for key and chord labels. Chord spelling now follows the local key. This updates key/chord labels and ABC notation without changing musical pitches or timing.
If you downloaded the repository or model before this update (2026-09-24), please update to the latest repository code. **Model weights are unchanged.**
<a id="quick-start"></a>
## 🚀 Quick start
Use Python 3.10 or 3.11 and FFmpeg 6.1 with its shared libraries. Sign in with access to this repository and its MERT-v2 parent:
```bashpython -m pip install huggingface-hub==0.36.0huggingface-cli download m-a-p/SheetSage2 --local-dir SheetSage2cd SheetSage2python -m pip install torch==2.8.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu126python -m pip install -r requirements.txt```
```pythonimport torchfrom transformers import AutoModel
model = AutoModel.from_pretrained( "m-a-p/SheetSage2", trust_remote_code=True,).eval().to("cuda" if torch.cuda.is_available() else "cpu")
result = model.transcribe("song.mp3", output_dir="output")```
Files are decoded, mixed to mono and resampled automatically. Long songs use overlapping windows.
| Output | File ||---|---|| Editable score | `score.abc` || Melody and chord accompaniment | `transcription.mid` || Separate melodies and chords | `melody_vocal.mid`, `melody_instrumental.mid`, `chords.mid` || Timed annotations | `events.json`, `*.lab` |
Omit `output_dir` to keep results in memory. Pass a Tensor or NumPy waveform with its sample rate:
```python# waveform: [samples] or [channels, samples]result = model.transcribe(waveform, sampling_rate=24000)abc = result["abc"] # strmidi = result["midi"] # bytesevents = result["events"] # list of timed events```
Paths, encoded audio bytes and binary streams are also accepted. `result["midis"]` contains the separate MIDI parts; `result["labs"]` contains annotation text. Request `export_logits=True`, `export_scores=True` or `export_embeddings=True` for CPU tensors in `result["tensors"]`, grouped by window; add `output_hidden_states=True` for all 24 MERT layers. With `output_dir`, these tensors are saved as safetensors instead. Low-level `forward()` returns logits and optional hidden states; `generate()` returns symbolic tokens.
Save a self-contained model for offline use:
```pythonmodel.save_pretrained("sheetsage2-local")model = AutoModel.from_pretrained( "sheetsage2-local", trust_remote_code=True, local_files_only=True,)```
### Key and chord spelling
Chord LAB annotations and ABC symbols use the local key at each chordinterval's midpoint to correct enharmonic root spelling, following SheetSage2 LM(for example, D#/G#/A# become Eb/Ab/Bb in C minor). Timing, chord quality,inversion and sounding pitches stay unchanged. Without a decoded key, spellingis preserved. Decoded events and tokens retain the original model predictions.This applies to both in-memory results and saved exports, including `paper=True`.
Key labels use the canonical LM/NoLM spelling (D#:major becomes Eb:major;C#:major becomes Db:major; A#:minor becomes Bb:minor) in decoded events,token display and exported key intervals. Numeric token IDs and the vocabularyfingerprint are unchanged. ABC melody spelling follows NoLM's key-relativepitch table, including accidental resets at barlines and key changes.
### Melody-only ABC for covers
Set `melody_only=True` to retain both the `Vocal` and `Ins` melodies while omitting chord symbols from the ABC and chord accompaniment from playback/combined MIDI. Raw predicted annotations remain available; the default full transcription is unchanged.
```pythonresult = model.transcribe("song.mp3", output_dir="cover-score", melody_only=True)abc = result["abc"] # Also saved as cover-score/score.abc.```
```bashpython infer.py song.mp3 --output cover-score --melody-only```
Review the transcription, then pass `result["abc"]` or the saved `cover-score/score.abc` to [YuE2](https://huggingface.co/m-a-p/YuE2-3B) as `abc`, with `cot="melody"` and your target `style` and `lyrics`. If the requested ABC cannot be produced, Python raises an error (partial results are available as `error.result`) and the CLI exits with a nonzero status.
### Command line and rendering
```bashpython infer.py song.mp3 --output output
# Optional piano audio and printable sheet music:python setup_render.pypython infer.py song.mp3 --output output --render-audio --render-score
# Render existing results without loading the model:python render.py --input output --output rendered --audio --score pdf,svg,png```
On minimal Linux servers, use `python setup_render.py --with-deps`. Audio follows the original MIDI timing. Scores preserve the vocal and instrumental staves. For separate piano previews, use `--render-parts vocal,instrumental,chords` with `infer.py`, or `--parts vocal,instrumental,chords` with `render.py`.
Python also accepts `render_audio=True, render_score="pdf,svg,png"`. In memory mode, `result["rendered"]` contains `audio` (part → WAV bytes) and `score` (format → pages as PDF/PNG bytes or SVG text).
<a id="benchmarks"></a>
## 📊 Benchmarks
Scores (%); higher is better. SheetSage2 uses BF16 inference. Use `preset="paper"` or `--preset paper` with the dataset prompts in [scores and settings](benchmark_results.json).
| Task | Dataset | Metric | SheetSage1 | madmom | Specialist | SheetSage2 ||---|---|---|---:|---:|---:|---:|| Beat | GTZAN | F1 | 86.07 | 86.07 | **89.01** [Beat This!][beat] | 86.27 || Beat | osu2017 | F1 | 91.80 | 91.80 | 89.19 [Beat This!][beat] | **93.01** || Downbeat | GTZAN | F1 | 64.65 | 64.65 | 78.28 [Beat This!][beat] | **80.45** || Downbeat | osu2017 | F1 | 83.47 | 83.47 | 85.90 [Beat This!][beat] | **92.90** || Key | GiantSteps | Score | 43.89 | 74.62 | 72.09 [S-KEY][key] | **77.73** || Key | GTZAN | Score | 54.56 | 72.05 | 74.43 [S-KEY][key] | **75.77** || Chord | osu2017 | Maj/min | 79.82 | 77.42 | 86.55 [ChordFormer][chordformer] | **90.08** || Chord | Chords1217 | Maj/min | 72.98 | 83.52* | **83.94**† [ChordFormer][chordformer] | 83.81 || Chord | JAAH | Maj/min | 39.77 | 51.24 | 59.45 [ChordFormer][chordformer] | **64.50** || Structure | HarmonixSet | Accuracy | — | — | 80.03 [SongFormer][structure] | **80.51** || Structure | HarmonixSet | F1 @ 0.5 s | — | — | **70.63** [SongFormer][structure] | 67.96 || Structure | HarmonixSet | F1 @ 3 s | — | — | 79.50 [SongFormer][structure] | **82.86** || Melody | RWC-Pop | Vocal F1 | 62.71 | — | 62.71 [SheetSage1][sheetsage] | **82.51** || Melody | RWC-Pop | Full F1 | 64.02 | — | 64.02 [SheetSage1][sheetsage] | **75.29** |
Beat/downbeat F1 uses a 70 ms matching tolerance and excludes reference and predicted events before 5 s for all models. We evaluate 999 GTZAN tracks for beat, 993 for downbeat, and 142 osu2017 tracks for both. Beat This! uses its original inference settings without DBN postprocessing; scores are averaged over three released training seeds.
Melody F1 uses pitch classes. SheetSage1 beat/downbeat results use madmom. *The madmom chord model includes Chords1217 in training. †ChordFormer uses five-fold evaluation, with one held-out model per track. Its original scorer pools metric-eligible durations; we recompute per-track recall and weight it by each reference span to match the other models' scoring protocol. SheetSage2 uses one checkpoint across all tracks.
SheetSage2 has the highest point estimate on 11 of 14 benchmark–metric pairs. Bold marks point estimates, not statistical significance.
ChordFormer is the chord specialist on all three datasets. We evaluate its released checkpoints with the official default chord vocabulary and HMM decoder: a five-model probability ensemble on osu2017 and JAAH, and one held-out fold model per track on Chords1217. All use the same frozen references and scoring as SheetSage2: per-track `mir_eval` chord recall weighted by the complete reference annotation span. See [osu2017 and Chords1217 results and reproduction](benchmarks/chordformer.md).
On all **113 JAAH recordings**, SheetSage2-AR improves Maj/min recall over ChordFormer by **5.06 percentage points** (paired song-bootstrap 95% CI: **1.29–7.97**). SheetSage2-Prober scores **62.94% Maj/min**. All models use the same reference spans, intersected with the audio; metric-eligible reference coverage is **93.87%**. See [JAAH results, fixed-model protocols, and confidence intervals](benchmarks/jaah.md).
### Benchmark updates
- **2026-09-16:** Added Maj/min chord evaluation on all 113 JAAH recordings: SheetSage2-AR **64.50%**, ChordFormer **59.45%**, and Prober **62.94%**. Added per-track scores, metric coverage, bootstrap intervals, and protocol details. Existing benchmark scores are unchanged.
- **2026-09-15:** Replaced the Jiang et al. chord baseline with ChordFormer on osu2017 (**86.55%**), and replaced the literature-only Chords1217 entry with our rescored held-out predictions (**83.94%**). SheetSage2 scores are unchanged.
- **2026-09-14:** Updated beat/downbeat scores with a shared 5-second exclusion protocol. Beat This! was rerun under its original settings, averaging scores across three released seeds. Key metric labels are now consistent with the report (Score).
[beat]: https://doi.org/10.5281/zenodo.14877491[key]: https://doi.org/10.1109/ICASSP49660.2025.10890222[chordformer]: https://arxiv.org/abs/2502.11840[structure]: https://arxiv.org/abs/2510.02797[sheetsage]: https://arxiv.org/abs/2212.01884
<a id="citation"></a>
## 📚 Citation
**Technical report coming soon.** For now, please cite [YuE](https://arxiv.org/abs/2503.08638) and [MERT](https://proceedings.iclr.cc/paper_files/paper/2024/hash/33dffa2e3d2ab74a783d1a8c292f66d9-Abstract-Conference.html) when using SheetSage2 in your research.
```bibtex@article{yuan2025yue, title = {{YuE}: Scaling Open Foundation Models for Long-Form Music Generation}, author = {Yuan, Ruibin and Lin, Hanfeng and Guo, Shuyue and Zhang, Ge and Pan, Jiahao and Zang, Yongyi and Liu, Haohe and Liang, Yiming and Ma, Wenye and Du, Xingjian and Du, Xinrun and Ye, Zhen and Zheng, Tianyu and Jiang, Zhengxuan and Ma, Yinghao and Liu, Minghao and Tian, Zeyue and Zhou, Ziya and Xue, Liumeng and Qu, Xingwei and Li, Yizhi and Wu, Shangda and Shen, Tianhao and Ma, Ziyang and Zhan, Jun and Wang, Chunhui and Wang, Yatian and Chi, Xiaowei and Zhang, Xinyue and Yang, Zhenzhu and Wang, Xiangzhou and Liu, Shansong and Mei, Lingrui and Li, Peng and Wang, Junjie and Yu, Jianwei and Pang, Guojian and Li, Xu and Wang, Zihao and Zhou, Xiaohuan and Yu, Lijun and Benetos, Emmanouil and Chen, Yong and Lin, Chenghua and Chen, Xie and Xia, Gus and Zhang, Zhaoxiang and Zhang, Chao and Chen, Wenhu and Zhou, Xinyu and Qiu, Xipeng and Dannenberg, Roger and Liu, Jiaheng and Yang, Jian and Huang, Wenhao and Xue, Wei and Tan, Xu and Guo, Yike}, journal = {arXiv preprint arXiv:2503.08638}, year = {2025}, eprint = {2503.08638}, archivePrefix = {arXiv}, url = {https://arxiv.org/abs/2503.08638}}
@inproceedings{li2024mert, title = {MERT: Acoustic Music Understanding Model with Large-Scale Self-supervised Training}, author = {Li, Yizhi and Yuan, Ruibin and Zhang, Ge and Ma, Yinghao and Chen, Xingran and Yin, Hanzhi and Xiao, Chenghao and Lin, Chenghua and Ragni, Anton and Benetos, Emmanouil and Gyenge, Norbert and Dannenberg, Roger and Liu, Ruibo and Chen, Wenhu and Xia, Gus and Shi, Yemin and Huang, Wenhao and Wang, Zili and Guo, Yike and Fu, Jie}, booktitle = {International Conference on Learning Representations}, year = {2024}, url = {https://proceedings.iclr.cc/paper_files/paper/2024/hash/33dffa2e3d2ab74a783d1a8c292f66d9-Abstract-Conference.html}}```
Weights: [CC BY-NC 4.0](LICENSE). [Third-party notices](THIRD_PARTY_NOTICES.md).
**YuE2 family:** [Song generation](https://huggingface.co/m-a-p/YuE2-3B) · [Music representations](https://huggingface.co/m-a-p/MERT-v2-FullSong) · [Audio decoder](https://huggingface.co/m-a-p/YuE2-Vae).123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464{ "scores": [ { "task": "beat", "dataset": "GTZAN", "metric": "F1", "score": 86.27, "settings": { "preset": "paper", "sample_rate": 24000, "window_seconds": 300, "overlap_seconds": 100, "lookahead_seconds": 0, "max_length": 5120, "decoding": "greedy", "attention": "sdpa", "weight_dtype": "float32", "autocast_dtype": "bfloat16", "batch_size": 1, "prompts": [ "timestamp", "downbeat_meter", "key" ], "device": "NVIDIA H800", "cuda_version": "12.6" }, "evaluation": { "num_tracks": 999, "matching_tolerance_seconds": 0.07, "min_event_time_seconds": 5.0, "trim_reference_and_predictions": true, "aggregation": "macro_average_per_track_f1" } }, { "task": "beat", "dataset": "osu2017", "metric": "F1", "score": 93.01, "settings": { "preset": "paper", "sample_rate": 24000, "window_seconds": 300, "overlap_seconds": 100, "lookahead_seconds": 0, "max_length": 5120, "decoding": "greedy", "attention": "sdpa", "weight_dtype": "float32", "autocast_dtype": "bfloat16", "batch_size": 1, "prompts": [ "timestamp", "downbeat_meter", "key", "chord_full" ], "device": "NVIDIA H800", "cuda_version": "12.6" }, "evaluation": { "num_tracks": 142, "matching_tolerance_seconds": 0.07, "min_event_time_seconds": 5.0, "trim_reference_and_predictions": true, "aggregation": "macro_average_per_track_f1" } }, { "task": "downbeat", "dataset": "GTZAN", "metric": "F1", "score": 80.45, "settings": { "preset": "paper", "sample_rate": 24000, "window_seconds": 300, "overlap_seconds": 100, "lookahead_seconds": 0, "max_length": 5120, "decoding": "greedy", "attention": "sdpa", "weight_dtype": "float32", "autocast_dtype": "bfloat16", "batch_size": 1, "prompts": [ "timestamp", "downbeat_meter", "key" ], "device": "NVIDIA H800", "cuda_version": "12.6" }, "evaluation": { "num_tracks": 993, "matching_tolerance_seconds": 0.07, "min_event_time_seconds": 5.0, "trim_reference_and_predictions": true, "aggregation": "macro_average_per_track_f1" } }, { "task": "downbeat", "dataset": "osu2017", "metric": "F1", "score": 92.9, "settings": { "preset": "paper", "sample_rate": 24000, "window_seconds": 300, "overlap_seconds": 100, "lookahead_seconds": 0, "max_length": 5120, "decoding": "greedy", "attention": "sdpa", "weight_dtype": "float32", "autocast_dtype": "bfloat16", "batch_size": 1, "prompts": [ "timestamp", "downbeat_meter", "key", "chord_full" ], "device": "NVIDIA H800", "cuda_version": "12.6" }, "evaluation": { "num_tracks": 142, "matching_tolerance_seconds": 0.07, "min_event_time_seconds": 5.0, "trim_reference_and_predictions": true, "aggregation": "macro_average_per_track_f1" } }, { "task": "key", "dataset": "GiantSteps", "metric": "weighted_accuracy", "score": 77.73, "settings": { "preset": "paper", "sample_rate": 24000, "window_seconds": 300, "overlap_seconds": 100, "lookahead_seconds": 0, "max_length": 5120, "decoding": "greedy", "attention": "sdpa", "weight_dtype": "float32", "autocast_dtype": "bfloat16", "batch_size": 1, "prompts": [ "timestamp", "downbeat_meter", "key" ], "device": "NVIDIA H800", "cuda_version": "12.6" } }, { "task": "key", "dataset": "GTZAN", "metric": "weighted_accuracy", "score": 75.77, "settings": { "preset": "paper", "sample_rate": 24000, "window_seconds": 300, "overlap_seconds": 100, "lookahead_seconds": 0, "max_length": 5120, "decoding": "greedy", "attention": "sdpa", "weight_dtype": "float32", "autocast_dtype": "bfloat16", "batch_size": 1, "prompts": [ "timestamp", "downbeat_meter", "key" ], "device": "NVIDIA H800", "cuda_version": "12.6" } }, { "task": "chord", "dataset": "osu2017", "metric": "majmin", "score": 90.08, "settings": { "preset": "paper", "sample_rate": 24000, "window_seconds": 300, "overlap_seconds": 100, "lookahead_seconds": 0, "max_length": 5120, "decoding": "greedy", "attention": "sdpa", "weight_dtype": "float32", "autocast_dtype": "bfloat16", "batch_size": 1, "prompts": [ "timestamp", "downbeat_meter", "key", "chord_full" ], "device": "NVIDIA H800", "cuda_version": "12.6" } }, { "task": "chord", "dataset": "Chords1217", "metric": "majmin", "score": 83.81, "settings": { "preset": "paper", "sample_rate": 24000, "window_seconds": 300, "overlap_seconds": 100, "lookahead_seconds": 0, "max_length": 5120, "decoding": "greedy", "attention": "sdpa", "weight_dtype": "float32", "autocast_dtype": "bfloat16", "batch_size": 1, "prompts": [ "timestamp", "downbeat_meter", "chord_full" ], "device": "NVIDIA H800", "cuda_version": "12.6" } }, { "task": "chord", "dataset": "JAAH", "metric": "majmin", "score": 64.5, "settings": { "preset": "paper", "sample_rate": 24000, "window_seconds": 300, "overlap_seconds": 100, "lookahead_seconds": 0, "max_length": 5120, "decoding": "greedy", "attention": "sdpa", "weight_dtype": "float32", "autocast_dtype": "bfloat16", "batch_size": 1, "prompts": [ "timestamp", "downbeat_meter", "chord_full" ], "cuda_version": "12.6" }, "score_unrounded": 64.50302704985715, "num_tracks": 113, "source": "benchmarks/jaah_results.json", "evaluation": { "reference": "official_annotations_intersected_with_audio_span", "aggregation": "reference_span_weighted_mean_per_track_mir_eval_majmin", "eligible_reference_percent": 93.87347199893611, "ci95_percent": [ 61.02541843882439, 67.64783306565447 ] } }, { "task": "structure", "dataset": "HarmonixSet", "metric": "accuracy", "score": 80.51, "settings": { "preset": "paper", "sample_rate": 24000, "window_seconds": 300, "overlap_seconds": 100, "lookahead_seconds": 0, "max_length": 5120, "decoding": "greedy", "attention": "sdpa", "weight_dtype": "float32", "autocast_dtype": "bfloat16", "batch_size": 1, "prompts": [ "timestamp", "downbeat_meter", "structure" ], "device": "NVIDIA H800", "cuda_version": "12.6" } }, { "task": "structure", "dataset": "HarmonixSet", "metric": "F1@0.5s", "score": 67.96, "settings": { "preset": "paper", "sample_rate": 24000, "window_seconds": 300, "overlap_seconds": 100, "lookahead_seconds": 0, "max_length": 5120, "decoding": "greedy", "attention": "sdpa", "weight_dtype": "float32", "autocast_dtype": "bfloat16", "batch_size": 1, "prompts": [ "timestamp", "downbeat_meter", "structure" ], "device": "NVIDIA H800", "cuda_version": "12.6" } }, { "task": "structure", "dataset": "HarmonixSet", "metric": "F1@3s", "score": 82.86, "settings": { "preset": "paper", "sample_rate": 24000, "window_seconds": 300, "overlap_seconds": 100, "lookahead_seconds": 0, "max_length": 5120, "decoding": "greedy", "attention": "sdpa", "weight_dtype": "float32", "autocast_dtype": "bfloat16", "batch_size": 1, "prompts": [ "timestamp", "downbeat_meter", "structure" ], "device": "NVIDIA H800", "cuda_version": "12.6" } }, { "task": "melody", "dataset": "RWC-Pop", "metric": "vocal_pitch_class_F1", "score": 82.51, "settings": { "preset": "paper", "sample_rate": 24000, "window_seconds": 300, "overlap_seconds": 100, "lookahead_seconds": 0, "max_length": 5120, "decoding": "greedy", "attention": "sdpa", "weight_dtype": "float32", "autocast_dtype": "bfloat16", "batch_size": 1, "prompts": [ "timestamp", "downbeat_meter", "structure", "key", "chord_full", "melody_full" ], "device": "NVIDIA H800", "cuda_version": "12.6" } }, { "task": "melody", "dataset": "RWC-Pop", "metric": "full_pitch_class_F1", "score": 75.29, "settings": { "preset": "paper", "sample_rate": 24000, "window_seconds": 300, "overlap_seconds": 100, "lookahead_seconds": 0, "max_length": 5120, "decoding": "greedy", "attention": "sdpa", "weight_dtype": "float32", "autocast_dtype": "bfloat16", "batch_size": 1, "prompts": [ "timestamp", "downbeat_meter", "structure", "key", "chord_full", "melody_full" ], "device": "NVIDIA H800", "cuda_version": "12.6" } } ], "specialist_baselines": [ { "model": "ChordFormer", "task": "chord", "dataset": "osu2017", "metric": "Maj/min", "score": 86.55, "score_unrounded": 86.5497453460808, "num_tracks": 142, "aggregation": "reference_span_weighted_mean_per_track_mir_eval_majmin", "inference_protocol": "five_released_models_probability_ensemble", "vocabulary": "submission", "code_commit": "3da11c078c802b3f5a2ff0f6f8ec184a41537844", "source": "benchmarks/chordformer_results.json" }, { "model": "ChordFormer", "task": "chord", "dataset": "Chords1217", "metric": "Maj/min", "score": 83.94, "score_unrounded": 83.94339228883841, "num_tracks": 1217, "aggregation": "reference_span_weighted_mean_per_track_mir_eval_majmin", "inference_protocol": "one_released_held_out_fold_model_per_track", "vocabulary": "submission", "code_commit": "3da11c078c802b3f5a2ff0f6f8ec184a41537844", "source": "benchmarks/chordformer_results.json" }, { "model": "ChordFormer", "task": "chord", "dataset": "JAAH", "metric": "Maj/min", "score": 59.45, "score_unrounded": 59.44669210290719, "num_tracks": 113, "aggregation": "reference_span_weighted_mean_per_track_mir_eval_majmin", "inference_protocol": "five_released_models_probability_ensemble", "vocabulary": "submission", "code_commit": "3da11c078c802b3f5a2ff0f6f8ec184a41537844", "source": "benchmarks/jaah_results.json", "ci95_percent": [ 56.02619276510972, 62.7408426250374 ] } ]}1234567891011121314151617181920212223242526272829303132333435363738# JAAH chord benchmark
Updated 2026-09-16. All 113 recordings in the [Jazz Audio-Aligned Harmony (JAAH) dataset](https://doi.org/10.5281/zenodo.1291834) are evaluated with fixed models and the same reference intervals. Scores are percentages; higher is better. No model is trained or tuned on JAAH for this comparison.
## Results
| Model | Maj/min ||---|---:|| ChordFormer | 59.45 || SheetSage2-Prober | 62.94 || SheetSage2-AR | **64.50** |
AR improves over ChordFormer by **5.06 percentage points** (95% CI: **1.29–7.97**). The AR-minus-Prober difference is **1.56 points** (95% CI: **−0.44–4.15**), so that comparison remains uncertain. Intervals use a paired song-level bias-corrected and accelerated (BCa) bootstrap, 20,000 resamples and seed 20260916. Each resample recomputes the reference-span-weighted statistic with the same songs and weights for both models. Bold denotes the highest point estimate for these fixed models and recordings, not a claim of JAAH state of the art.
## Evaluation protocol
- **Cohort:** all 113 original recordings; no track or chorus selection, reference-beat inputs, test-time pitch augmentation, global timing shift, or JAAH parameter tuning. The audio is from the supplied recordings, not reconstructed spectrograms.- **References:** byte-preserved official chord labels at [JAAH commit `6fec3f6`](https://github.com/MTG/JAAH/tree/6fec3f6dd1d60c21cf9af855ea173be38e6d7243), intersected with each WAV's actual time span. Shorter annotations are not extended. This removes 9.146654 seconds of trailing `N` labels beyond the audio, leaving 24,991.969346 seconds. Five tracks have overruns above 20 ms and 37 have smaller rounding differences. The original labels are preserved.- **Metric:** per-track `mir_eval.chord.majmin` recall. Reference segments outside the metric's vocabulary receive `-1` and are excluded from that track's metric denominator; they are never converted to `N`. Eligible reference duration, including `N`, is **93.87%**.- **Aggregation:** weight each track's recall by its **complete evaluated reference span**. This is the same aggregation as the other SheetSage2 chord benchmarks. Macro averages and recall pooled by metric-eligible duration are retained in the JSON under separate names and are not the main-table values.- **ChordFormer:** five released Chords1217 fold models, component-probability ensemble followed by the official HMM, and the predeclared `submission` vocabulary, matching osu2017. On Chords1217 itself, each track instead uses only its held-out fold model. Source: [official ChordFormer commit `3da11c0`](https://github.com/mwaseemrandhawa/ChordFormer/tree/3da11c078c802b3f5a2ff0f6f8ec184a41537844).- **SheetSage2-Prober:** fixed checkpoint, 24-kHz mono audio, 300-second windows, BF16, batch size one, native predicted beats with a fixed zero global offset; melody decoding disabled.- **SheetSage2-AR:** fixed paper checkpoint, 24-kHz mono audio, 300-second windows with 100-second overlap and predicted-prefix carry, BF16 autocast with FP32 weights, SDPA, greedy decoding, and a 5,120-token limit. Prompts: `timestamp, downbeat_meter, chord_full`. Two of 132 windows (`blues_for_alice`, `lady_bird`) reach the token limit and use the existing decoder's recovery for incomplete events. All 113 tracks are retained.
Using the untrimmed official annotation spans changes each main score by less than 0.03 percentage points. ChordFormer's other fixed vocabulary, `full`, is included only as an auxiliary result (59.11 Maj/min); the primary vocabulary was fixed before seeing JAAH scores. Independent rescoring with `mir_eval` 0.7 and 0.8.2 agreed on all 904 model/reference/track combinations.
A title-and-performer audit found no matches between JAAH and Chords1217. This does not establish absence from foundation-model pretraining or constitute an audio-fingerprint audit. Published JAAH results on selected choruses, rewritten labels, different vocabularies, or different train/test splits are not directly comparable to this full-collection evaluation. Only chord results are reported here.
## Machine-readable results
- [Full-precision scores, reference variants, metric coverage, and checkpoint hashes](jaah_results.json)- [Per-track scores and prediction/reference SHA-256 hashes](jaah_per_song.csv): 904 rows = 113 tracks × four model/vocabulary variants × two reference policies. Main results use `reference_variant=audio_span` and exclude `ChordFormer_full_auxiliary`.- [Bootstrap intervals and paired differences](jaah_statistics.json)- [SheetSage2 paper preset and dataset prompts](../benchmark_results.json)
## Dataset citation
Vsevolod Eremenko, Emir Demirel, Baris Bozkurt, and Xavier Serra. “Audio-aligned jazz harmony dataset for automatic chord transcription and corpus-based research.” Proceedings of the 19th International Society for Music Information Retrieval Conference, 2018, pp. 483–490. [DOI: 10.5281/zenodo.1291834](https://doi.org/10.5281/zenodo.1291834).123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219{ "dataset": "JAAH", "tracks": 113, "primary_reference": "audio_span", "primary_chordformer_vocabulary": "submission", "primary_metric": "majmin", "aggregation": "reference-span-weighted mean of per-track mir_eval scores", "scorer_sha256": "5a74e06b566c5a39fa2c63e2bf3ee6685977d469b813e554c51397ae4b02ecb5", "mir_eval": "0.8.2", "numpy": "1.24.3", "results": { "ChordFormer": { "audio_span": { "summary": { "n": 113, "total_duration": 24991.969346, "majmin_macro": 0.598218672222064, "majmin": 0.594466921029072 }, "percent": { "majmin_macro": 59.82186722220641, "majmin": 59.44669210290719 }, "corpus_eligible_duration_weighted_percent": { "majmin": 59.626981188033206 }, "eligible_reference_seconds": { "majmin": 23460.829346000006 }, "eligible_reference_percent": { "majmin": 93.87347199893611 } }, "official_span": { "summary": { "n": 113, "total_duration": 25001.115999999998, "majmin_macro": 0.5984845689662535, "majmin": 0.5946247940369601 }, "percent": { "majmin_macro": 59.84845689662534, "majmin": 59.46247940369601 }, "corpus_eligible_duration_weighted_percent": { "majmin": 59.642715249031376 }, "eligible_reference_seconds": { "majmin": 23469.976 }, "eligible_reference_percent": { "majmin": 93.87571338815437 } } }, "ChordFormer_full_auxiliary": { "audio_span": { "summary": { "n": 113, "total_duration": 24991.969346, "majmin_macro": 0.5945973379959845, "majmin": 0.5911195668245862 }, "percent": { "majmin_macro": 59.459733799598446, "majmin": 59.11195668245862 }, "corpus_eligible_duration_weighted_percent": { "majmin": 59.28580372991986 }, "eligible_reference_seconds": { "majmin": 23460.829346000006 }, "eligible_reference_percent": { "majmin": 93.87347199893611 } }, "official_span": { "summary": { "n": 113, "total_duration": 25001.115999999998, "majmin_macro": 0.5948641720345073, "majmin": 0.5912787598995988 }, "percent": { "majmin_macro": 59.48641720345073, "majmin": 59.127875989959875 }, "corpus_eligible_duration_weighted_percent": { "majmin": 59.301670753651415 }, "eligible_reference_seconds": { "majmin": 23469.976 }, "eligible_reference_percent": { "majmin": 93.87571338815437 } } }, "SheetSage2-Prober": { "audio_span": { "summary": { "n": 113, "total_duration": 24991.969346, "majmin_macro": 0.6257256809828833, "majmin": 0.6294130449403118 }, "percent": { "majmin_macro": 62.57256809828833, "majmin": 62.94130449403118 }, "corpus_eligible_duration_weighted_percent": { "majmin": 62.983243806422934 }, "eligible_reference_seconds": { "majmin": 23460.829346000006 }, "eligible_reference_percent": { "majmin": 93.87347199893611 } }, "official_span": { "summary": { "n": 113, "total_duration": 25001.115999999998, "majmin_macro": 0.6259663482622727, "majmin": 0.6295569569223054 }, "percent": { "majmin_macro": 62.59663482622727, "majmin": 62.95569569223054 }, "corpus_eligible_duration_weighted_percent": { "majmin": 62.99766987405528 }, "eligible_reference_seconds": { "majmin": 23469.976 }, "eligible_reference_percent": { "majmin": 93.87571338815437 } } }, "SheetSage2-AR": { "audio_span": { "summary": { "n": 113, "total_duration": 24991.969346, "majmin_macro": 0.6481228656738396, "majmin": 0.6450302704985715 }, "percent": { "majmin_macro": 64.81228656738396, "majmin": 64.50302704985715 }, "corpus_eligible_duration_weighted_percent": { "majmin": 64.66985937670378 }, "eligible_reference_seconds": { "majmin": 23460.829346000006 }, "eligible_reference_percent": { "majmin": 93.87347199893611 } }, "official_span": { "summary": { "n": 113, "total_duration": 25001.115999999998, "majmin_macro": 0.6483588585539686, "majmin": 0.6451685510270442 }, "percent": { "majmin_macro": 64.83588585539685, "majmin": 64.51685510270441 }, "corpus_eligible_duration_weighted_percent": { "majmin": 64.68362813835002 }, "eligible_reference_seconds": { "majmin": 23469.976 }, "eligible_reference_percent": { "majmin": 93.87571338815437 } } } }, "pending_models": [], "date": "2026-09-16", "dataset_citation": "https://doi.org/10.5281/zenodo.1291834", "annotation_commit": "6fec3f6dd1d60c21cf9af855ea173be38e6d7243", "model_provenance": { "ChordFormer": { "code_commit": "3da11c078c802b3f5a2ff0f6f8ec184a41537844", "inference": "five released Chords1217 models; component-probability ensemble; official HMM; submission vocabulary" }, "SheetSage2-Prober": { "checkpoint_sha256": "a9148c5117e237a551d454fe2f9ddf59e11c9d094e6fd195feb25819d882d211", "inference": "fixed checkpoint; 300-second windows; BF16; batch size 1; native predicted beats; zero global offset" }, "SheetSage2-AR": { "checkpoint_sha256": "aa399ee6090d78154e9eaa61df27272fecb8014190d0cc02e0b4f7f7271c65b2", "inference": "fixed paper checkpoint; 300-second windows; 100-second overlap; predicted-prefix carry; BF16 autocast; FP32 weights; greedy; 5120-token limit", "prompts": [ "timestamp", "downbeat_meter", "chord_full" ] } }, "foundation_checkpoint_sha256": "9011e52d49b430123583c5560f13398e56280539f9e635b985009f12043cea58", "reference_policy": "Intersect each official annotation with its WAV span. Do not extend shorter annotations or remove tracks. Weight per-track recall by the entire evaluated reference span, not only metric-eligible duration.", "limitations": [ "The AR-minus-Prober Maj/min confidence interval spans zero.", "Two of 132 AR windows hit the token limit and use the existing incomplete-event recovery; all 113 tracks are included.", "No title/performer match with Chords1217 was found; this is not a corpus-wide audio-fingerprint or foundation-pretraining audit." ]}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162{ "method": "Paired song-level BCa bootstrap; 20000 resamples; seed 20260916; reference-span-weighted statistic; same tracks and weights in every comparison", "n": 113, "models": { "ChordFormer": { "majmin": { "percent": 59.44669210290719, "ci95_percent": [ 56.02619276510972, 62.7408426250374 ] } }, "SheetSage2-Prober": { "majmin": { "percent": 62.94130449403118, "ci95_percent": [ 59.497683691902395, 66.13627549807268 ] } }, "SheetSage2-AR": { "majmin": { "percent": 64.50302704985715, "ci95_percent": [ 61.02541843882439, 67.64783306565447 ] } } }, "paired_differences": { "SheetSage2-AR minus ChordFormer": { "majmin": { "percent": 5.056334946949961, "ci95_percent": [ 1.2873218715694312, 7.972850526491037 ] } }, "SheetSage2-Prober minus ChordFormer": { "majmin": { "percent": 3.4946123911239906, "ci95_percent": [ 0.21856716173898302, 6.219670037878378 ] } }, "SheetSage2-AR minus SheetSage2-Prober": { "majmin": { "percent": 1.5617225558259702, "ci95_percent": [ -0.4363468802817946, 4.146782316815402 ] } } }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448"""Hugging Face SheetSage2 model with a shared MERT-v2 encoder."""
from dataclasses import dataclassimport copyimport hashlibfrom pathlib import Pathimport shutilfrom types import SimpleNamespacefrom typing import Optional, Tuple
import torchfrom torch import nnfrom torch.nn import functional as Ffrom transformers import AutoModel, BartConfig, PreTrainedModelfrom transformers.models.bart.modeling_bart import BartDecoderfrom transformers.utils import ModelOutputfrom transformers.utils.hub import cached_file
from .configuration_mert2 import MERT2Configfrom .modeling_mert2 import MERT2Modelfrom .configuration_sheetsage2 import SheetSage2Configfrom .tokenization_sheetsage2 import SheetSage2Tokenizer
PROJECTIONS = ("query_proj", "key_proj", "value_proj", "out_proj")BASE_CODE_HASHES = { "configuration_mert2.py": "77b53ec9d7ee31a599d744fb006e812c7eeaf7390deb46e2f460cf8c17b00bd6", "modeling_mert2.py": "b1a3174e5649c4b26b0c90d8626f0adacfbbba111a58ed3bb72ad651945a2f5c",}
def _hf_relative_dependencies(): # Transformers 4.45 copies direct imports into a fresh local module cache. from .audio_sheetsage2 import load_audio from .durations_sheetsage2 import DURATION_TEMPLATES from .exports_sheetsage2 import export_result from .io_sheetsage2 import atomic_write_text from .labels_sheetsage2 import STRUCTURE_LABELS from .midi_sheetsage2 import export_playback from .notation_sheetsage2 import generate_abc_from_exports from .rendering_sheetsage2 import render_outputs from .schema_sheetsage2 import get_prompt_multitask_schema from .tensors_sheetsage2 import WindowTensorWriter
def _sha256(path): digest = hashlib.sha256() with Path(path).open("rb") as stream: for block in iter(lambda: stream.read(8 << 20), b""): digest.update(block) return digest.hexdigest()
@dataclassclass SheetSage2EncoderOutput(ModelOutput): """Frame features. Block states exclude the separately returned input state."""
encoder_last_hidden_state: Optional[torch.FloatTensor] = None backbone_last_hidden_state: Optional[torch.FloatTensor] = None mixed_hidden_state: Optional[torch.FloatTensor] = None input_hidden_state: Optional[torch.FloatTensor] = None backbone_hidden_states: Optional[Tuple[torch.FloatTensor, ...]] = None feature_attention_mask: Optional[torch.BoolTensor] = None
@property def last_hidden_state(self): return self.encoder_last_hidden_state
@dataclassclass SheetSage2Output(ModelOutput): logits: Optional[torch.FloatTensor] = None past_key_values: Optional[Tuple] = None decoder_hidden_states: Optional[Tuple[torch.FloatTensor, ...]] = None encoder_last_hidden_state: Optional[torch.FloatTensor] = None backbone_last_hidden_state: Optional[torch.FloatTensor] = None mixed_hidden_state: Optional[torch.FloatTensor] = None input_hidden_state: Optional[torch.FloatTensor] = None backbone_hidden_states: Optional[Tuple[torch.FloatTensor, ...]] = None feature_attention_mask: Optional[torch.BoolTensor] = None
class AttentionAdapter(nn.Module): def __init__(self, width, rank): super().__init__() self.lora_A = nn.Linear(width, rank, bias=False) self.lora_B = nn.Linear(rank, width, bias=False)
class EncoderAdapters(nn.Module): def __init__(self, config): super().__init__() self.layers = nn.ModuleList() for _ in range(config.backbone_config["num_hidden_layers"]): layer = nn.Module() layer.attn = nn.Module() for name in PROJECTIONS: setattr(layer.attn, name, AttentionAdapter(config.backbone_config["hidden_size"], config.lora_rank)) self.layers.append(layer)
class SheetSage2Model(PreTrainedModel): """Audio-to-symbolic model, with optional frame and decoder representations.
``from_pretrained`` loads the pinned MERT-v2 parent and merges attention adapters in float32. ``save_pretrained`` writes an independent merged model. ``forward`` returns raw vocabulary logits; grammar-masked generation scores are available separately through ``generate(output_scores=True)``. """
config_class = SheetSage2Config base_model_prefix = "" main_input_name = "input_values" _supports_sdpa = True _tied_weights_keys = ["decoder.embed_tokens.weight", "output_projection.weight"] _no_split_modules = ["ConformerBlock", "BartDecoderLayer"]
def __init__(self, config): super().__init__(config) self.hparams = SimpleNamespace(input_audio_length=config.input_audio_length, time_hz=config.time_hz) self.max_output_seq_len = config.max_output_seq_len self.tokenizer = SheetSage2Tokenizer( config.input_audio_length, config.time_hz, config.tokenizer_schema_version, expected_fingerprint=config.tokenizer_fingerprint, ) if self.tokenizer.n_tokens != config.vocab_size: raise ValueError("Tokenizer vocabulary size does not match the model.") if config.weights_format == "adapter": self.encoder = None self.adapter = EncoderAdapters(config) else: ec = MERT2Config(**config.backbone_config) ec._attn_implementation = config.encoder_attn_implementation self.encoder = MERT2Model(ec) self.adapter = None self.layer_weight = nn.Parameter(torch.zeros(config.backbone_config["num_hidden_layers"] + 1)) self.encoder_projection = nn.Linear(config.backbone_config["hidden_size"], config.hidden_size) dc = BartConfig( vocab_size=config.vocab_size, d_model=config.hidden_size, decoder_layers=config.decoder_layers, decoder_attention_heads=config.num_attention_heads, decoder_ffn_dim=config.intermediate_size, max_position_embeddings=config.max_output_seq_len, dropout=config.decoder_dropout, attention_dropout=config.decoder_dropout, activation_dropout=config.decoder_dropout, activation_function="gelu", pad_token_id=config.pad_token_id, bos_token_id=config.bos_token_id, eos_token_id=config.eos_token_id, is_encoder_decoder=True, use_cache=True, ) dc._attn_implementation = "sdpa" self.token_embedding = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=config.pad_token_id) self.decoder = BartDecoder(dc, embed_tokens=self.token_embedding) self.decoder.gradient_checkpointing_disable() self.output_projection = nn.Linear(config.hidden_size, config.vocab_size, bias=False) self.output_projection.weight = self.token_embedding.weight self.lora_merged = config.weights_format == "merged" self.post_init()
def get_input_embeddings(self): return self.token_embedding
def set_input_embeddings(self, value): self.token_embedding = value self.decoder.embed_tokens.weight = value.weight
def tie_weights(self): super().tie_weights() if hasattr(self, "decoder") and hasattr(self, "token_embedding"): self.decoder.embed_tokens.weight = self.token_embedding.weight
def get_output_embeddings(self): return self.output_projection
def set_output_embeddings(self, value): self.output_projection = value
def _init_weights(self, module): if isinstance(module, (nn.Linear, nn.Embedding)): nn.init.normal_(module.weight, mean=0.0, std=0.02) if getattr(module, "bias", None) is not None: nn.init.zeros_(module.bias) if isinstance(module, nn.Embedding) and module.padding_idx is not None: module.weight.data[module.padding_idx].zero_() elif isinstance(module, nn.LayerNorm): nn.init.ones_(module.weight) nn.init.zeros_(module.bias)
@torch.no_grad() def merge_lora(self): if self.lora_merged: return self if self.encoder is None or self.adapter is None: raise RuntimeError("Load both the MERT-v2 parent and adapters before merging.") scale = self.config.lora_alpha / self.config.lora_rank with torch.autocast("cpu", enabled=False): for layer, adapter in zip(self.encoder.layers, self.adapter.layers): for name in PROJECTIONS: projection = getattr(layer.attn, name) update = getattr(adapter.attn, name) values = (projection.weight, update.lora_A.weight, update.lora_B.weight) if any(value.device.type != "cpu" or value.dtype != torch.float32 for value in values): raise ValueError("Merge adapters on CPU with float32 parameters.") projection.weight.add_((update.lora_B.weight @ update.lora_A.weight) * scale) self.adapter = None self.lora_merged = True self.config.weights_format = "merged" return self
@classmethod def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs): base_path = kwargs.pop("base_model_path", None) requested_dtype = kwargs.pop("torch_dtype", torch.float32) target_device = kwargs.pop("device_map", None) backend = kwargs.pop("attn_implementation", None) return_loading_info = kwargs.pop("output_loading_info", False) config = kwargs.pop("config", None) hub_keys = ("cache_dir", "force_download", "local_files_only", "token", "revision", "subfolder") hub_args = {name: kwargs[name] for name in hub_keys if name in kwargs} if config is None: config = cls.config_class.from_pretrained(pretrained_model_name_or_path, **hub_args) if backend is not None: config.encoder_attn_implementation = backend if config.encoder_attn_implementation not in {"sdpa", "flash_attention_2"}: raise ValueError("Select attn_implementation='sdpa' or 'flash_attention_2'.") if isinstance(target_device, dict): if set(target_device) != {""}: raise ValueError("Use a single device for SheetSage2: device_map={'': 'cuda:0'}.") target_device = target_device[""] if target_device == "auto": target_device = "cuda" if torch.cuda.is_available() else "cpu" if requested_dtype == "auto": requested_dtype = torch.float32 if isinstance(requested_dtype, str): requested_dtype = getattr(torch, requested_dtype, None) if requested_dtype not in {None, torch.float32, torch.bfloat16, torch.float16}: raise ValueError("Use torch_dtype float32, bfloat16, float16, or 'auto'.") # Adapters must be loaded and merged before any reduced-precision cast. model, loading_info = super().from_pretrained( pretrained_model_name_or_path, *model_args, config=config, torch_dtype=torch.float32, attn_implementation="sdpa", output_loading_info=True, **kwargs, ) if any(loading_info.get(name) for name in ("missing_keys", "unexpected_keys", "mismatched_keys", "error_msgs")): raise ValueError(f"Incomplete or incompatible SheetSage2 weights: {loading_info}") if config.weights_format == "adapter": parent = str(base_path or config.base_model_name_or_path) parent_hub_args = {name: hub_args[name] for name in ("cache_dir", "force_download", "local_files_only", "token") if name in hub_args} parent_hub_args["revision"] = config.base_model_revision expected_files = dict(BASE_CODE_HASHES, **{"model.safetensors": config.base_model_sha256}) for filename, expected in expected_files.items(): resolved = cached_file(parent, filename, **parent_hub_args) if _sha256(resolved) != expected: raise ValueError(f"MERT-v2 parent integrity check failed: {filename}") model.encoder = AutoModel.from_pretrained( parent, trust_remote_code=True, code_revision=config.base_model_revision, torch_dtype=torch.float32, attn_implementation=config.encoder_attn_implementation, **parent_hub_args, ) for name, expected in config.backbone_config.items(): if name in ("hidden_size", "intermediate_size", "num_hidden_layers", "num_attention_heads", "sampling_rate", "hop_length", "n_fft", "win_length", "num_mel_bins", "conv_depthwise_kernel_size", "rotary_embedding_base", "subsampling_channels", "subsampling_depths", "layer_norm_eps", "subsampling_layer_norm_eps", "variant"): if getattr(model.encoder.config, name) != expected: raise ValueError(f"MERT-v2 parent architecture mismatch: {name}") model.merge_lora() if requested_dtype is not None: model.to(dtype=requested_dtype) if target_device is not None: model.to(target_device) # Resource lookup follows the caller's cache and offline settings. These # transient options are never written into config or model weights. model._hub_resource_options = {name: hub_args[name] for name in ("cache_dir", "local_files_only", "token") if name in hub_args} resource_args = dict(model._hub_resource_options, local_files_only=True, revision=config._commit_hash or hub_args.get("revision"), subfolder=hub_args.get("subfolder", ""), _raise_exceptions_for_missing_entries=False) resource_config = cached_file(str(pretrained_model_name_or_path), "config.json", **resource_args) model._source_snapshot = Path(resource_config).parent if resource_config else Path(pretrained_model_name_or_path) model.eval().requires_grad_(False) return (model, loading_info) if return_loading_info else model
def save_pretrained(self, save_directory, *args, **kwargs): if not self.lora_merged or self.encoder is None: raise ValueError("Load and merge the model before saving a standalone snapshot.") original_config = self.config source = original_config._name_or_path self.config = copy.deepcopy(original_config) self.config.weights_format = "merged" self.config._name_or_path = "" self.config.backbone_config.pop("_name_or_path", None) try: result = super().save_pretrained(save_directory, *args, **kwargs) from .processing_sheetsage2 import SheetSage2Processor SheetSage2Processor.from_model_config(self.config).save_pretrained(save_directory) finally: self.config = original_config source_dir = getattr(self, "_source_snapshot", Path(source)) if source and not source_dir.is_dir(): from huggingface_hub import snapshot_download try: source_dir = Path(snapshot_download(source, revision=original_config._commit_hash, cache_dir=getattr(self, "_hub_resource_options", {}).get("cache_dir"), local_files_only=True)) except (OSError, ValueError): source_dir = None if source and source_dir is not None and source_dir.is_dir(): destination = Path(save_directory) for name in ("infer.py", "render.py", "setup_render.py", "requirements.txt", "requirements-render.txt", "LICENSE", "THIRD_PARTY_NOTICES.md"): if (source_dir / name).is_file() and (source_dir / name).resolve() != (destination / name).resolve(): shutil.copy2(source_dir / name, destination / name) assets = source_dir / "render_assets" if (assets / "manifest.json").is_file() and assets.resolve() != (destination / "render_assets").resolve(): from .rendering_sheetsage2 import _verify_assets try: _verify_assets(assets, audio=True) except (FileNotFoundError, ValueError): pass else: shutil.copytree(assets, destination / "render_assets", dirs_exist_ok=True) return result
def _prepare_audio(self, input_values, attention_mask=None): if self.encoder is None or not self.lora_merged: raise RuntimeError("Load the model with from_pretrained before inference.") if input_values.ndim != 2 or input_values.shape[0] < 1 or not input_values.is_floating_point(): raise ValueError("input_values must be floating-point [batch, samples].") if not torch.isfinite(input_values).all(): raise ValueError("Audio must contain only finite samples.") batch, samples = input_values.shape minimum = self.encoder.config.minimum_input_samples window = round(self.config.input_audio_length * self.config.sampling_rate) if samples < minimum: raise ValueError(f"Each waveform must contain at least {minimum} samples.") if samples > window: raise ValueError("Audio exceeds one model window; use transcribe for whole songs.") if attention_mask is None: lengths = torch.full((batch,), samples, dtype=torch.long, device=input_values.device) else: if attention_mask.shape != input_values.shape: raise ValueError("attention_mask must have the same shape as input_values.") mask = attention_mask.to(device=input_values.device) if not ((mask == 0) | (mask == 1)).all(): raise ValueError("attention_mask must contain zeros and ones.") mask = mask.bool() lengths = mask.sum(1) expected = torch.arange(samples, device=input_values.device)[None] < lengths[:, None] if not torch.equal(mask, expected) or (lengths < minimum).any(): raise ValueError("attention_mask must identify a nonempty right-padded waveform.") input_values = input_values.masked_fill(~mask, 0) # The encoder attends to the complete fixed window, including this silence. input_values = F.pad(input_values.float(), (0, window - samples)) stride = self.encoder.config.inputs_to_logits_ratio if window % stride: input_values = F.pad(input_values, (0, stride - window % stride)) return input_values, lengths
def get_audio_features(self, input_values, attention_mask=None, output_hidden_states=None, return_dict=True): output_hidden_states = self.config.output_hidden_states if output_hidden_states is None else output_hidden_states waveform, lengths = self._prepare_audio(input_values, attention_mask) mel = self.encoder.feature_extractor(waveform) weight_dtype = self.encoder.subsampling_module[0].convnext_layers[0].depthwise_block[1].weight.dtype hidden = self.encoder.subsampling_module(mel.to(dtype=weight_dtype)) input_hidden = hidden if output_hidden_states else None weights = torch.softmax(self.layer_weight, dim=0) mixed = hidden * weights[0] positions = self.encoder.embed_positions(hidden) states = [] if output_hidden_states else None for weight, layer in zip(weights[1:], self.encoder.layers): hidden = layer(hidden, positions) mixed = mixed + hidden * weight if states is not None: states.append(hidden) memory = self.encoder_projection(mixed) stride = self.encoder.config.inputs_to_logits_ratio frame_mask = torch.arange(memory.shape[1], device=memory.device)[None] < ((lengths + stride - 1) // stride)[:, None] output = SheetSage2EncoderOutput( encoder_last_hidden_state=memory, backbone_last_hidden_state=hidden, mixed_hidden_state=mixed, input_hidden_state=input_hidden, backbone_hidden_states=tuple(states) if states is not None else None, feature_attention_mask=frame_mask, ) return output if return_dict else output.to_tuple()
def encode(self, audio): return self.get_audio_features(audio).last_hidden_state
def _decode(self, memory, decoder_input_ids, use_cache=False, past_key_values=None, output_hidden_states=False): attention_mask = None if past_key_values is not None else decoder_input_ids != self.tokenizer.pad_token output = self.decoder( input_ids=decoder_input_ids, attention_mask=attention_mask, encoder_hidden_states=memory, encoder_attention_mask=None, past_key_values=past_key_values, use_cache=use_cache, output_hidden_states=output_hidden_states, return_dict=True, ) return self.output_projection(output.last_hidden_state), output
def decode(self, memory, decoder_input_ids, use_cache=False, past_key_values=None): logits, output = self._decode(memory, decoder_input_ids, use_cache, past_key_values) return logits, output.past_key_values
def forward(self, input_values=None, decoder_input_ids=None, attention_mask=None, encoder_outputs=None, past_key_values=None, use_cache=None, output_hidden_states=None, return_dict=None): output_hidden_states = self.config.output_hidden_states if output_hidden_states is None else output_hidden_states use_cache = self.config.use_cache if use_cache is None else use_cache if decoder_input_ids is None: raise ValueError("decoder_input_ids is required for logits; use generate to transcribe audio.") if encoder_outputs is None: if input_values is None: raise ValueError("Provide input_values or encoder_outputs.") encoder_outputs = self.get_audio_features(input_values, attention_mask, output_hidden_states) if torch.is_tensor(encoder_outputs): encoder_outputs = SheetSage2EncoderOutput(encoder_last_hidden_state=encoder_outputs) logits, decoded = self._decode(encoder_outputs.last_hidden_state, decoder_input_ids, use_cache, past_key_values, output_hidden_states) output = SheetSage2Output( logits=logits, past_key_values=decoded.past_key_values, decoder_hidden_states=decoded.hidden_states, encoder_last_hidden_state=encoder_outputs.last_hidden_state, backbone_last_hidden_state=encoder_outputs.backbone_last_hidden_state if output_hidden_states else None, mixed_hidden_state=encoder_outputs.mixed_hidden_state if output_hidden_states else None, input_hidden_state=encoder_outputs.input_hidden_state if output_hidden_states else None, backbone_hidden_states=encoder_outputs.backbone_hidden_states if output_hidden_states else None, feature_attention_mask=encoder_outputs.feature_attention_mask, ) return_dict = self.config.use_return_dict if return_dict is None else return_dict return output if return_dict else output.to_tuple()
def generate(self, input_values, **kwargs): """Generate grammar-constrained symbolic tokens with autoregressive caching.""" from .generation_sheetsage2 import generate return generate(self, input_values, **kwargs)
def transcribe(self, audio, output_dir=None, *, melody_only=False, **kwargs): """Return transcription in memory; set output_dir to also save files.
Accepts a path, encoded audio bytes, binary stream, or waveform with sampling_rate. Returns ABC text, MIDI bytes, timed events, and optional per-window CPU tensors. With output_dir, optional tensors are saved instead of retained in memory. Set melody_only=True to retain both vocal and instrumental melodies while omitting chords from ABC and playback; raw predicted annotations remain available. The default keeps full transcription. See the model card for rendering options. """ from .pipeline_sheetsage2 import transcribe return transcribe(self, audio, output_dir=output_dir, melody_only=melody_only, **kwargs)
SheetSage2ForConditionalGeneration = SheetSage2ModelSheetSage2Model.register_for_auto_class("AutoModel")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109"""Waveform preparation and symbolic decoding for SheetSage2."""
import numbers
import torchimport torchaudiofrom transformers import ProcessorMixinfrom transformers.feature_extraction_utils import BatchFeature
from .tokenization_sheetsage2 import SheetSage2Tokenizer
def _hf_relative_dependencies(): # Keep standalone AutoProcessor loading compatible with Transformers 4.45. from .durations_sheetsage2 import DURATION_TEMPLATES from .labels_sheetsage2 import STRUCTURE_LABELS from .schema_sheetsage2 import get_prompt_multitask_schema
class SheetSage2Processor(ProcessorMixin): """Prepare mono waveforms without amplitude normalization.
Pass one mono waveform, a batch tensor, or a list of mono waveforms. Use ``model.transcribe`` for files and audio longer than one model window. """
attributes = [] valid_kwargs = ["sampling_rate", "window_seconds", "time_hz", "schema_version", "tokenizer_fingerprint"]
def __init__(self, sampling_rate=24000, window_seconds=300.0, time_hz=100, schema_version="v1", tokenizer_fingerprint="5ba3325af0344c7f", **kwargs): super().__init__(**{key: value for key, value in kwargs.items() if key == "chat_template"}) self.sampling_rate = int(sampling_rate) self.window_seconds = float(window_seconds) self.time_hz = int(time_hz) self.schema_version = str(schema_version) self.tokenizer_fingerprint = str(tokenizer_fingerprint) self.tokenizer = SheetSage2Tokenizer( self.window_seconds, self.time_hz, self.schema_version, expected_fingerprint=self.tokenizer_fingerprint, )
@property def model_input_names(self): return ["input_values", "attention_mask"]
@classmethod def from_model_config(cls, config): return cls(config.sampling_rate, config.input_audio_length, config.time_hz, config.tokenizer_schema_version, config.tokenizer_fingerprint)
def __call__(self, audio, sampling_rate=None, padding=True, return_tensors="pt", return_attention_mask=True): source_rate = self.sampling_rate if sampling_rate is None else int(sampling_rate) if source_rate <= 0: raise ValueError("sampling_rate must be positive.") if isinstance(audio, (str, bytes)): raise ValueError("Pass waveform samples here; use model.transcribe for audio files.") if isinstance(audio, (list, tuple)) and audio and not isinstance(audio[0], numbers.Number): waveforms = [torch.as_tensor(value) for value in audio] else: value = torch.as_tensor(audio) waveforms = list(value) if value.ndim == 2 else [value] if not waveforms: raise ValueError("Provide at least one waveform.") prepared = [] maximum = round(self.window_seconds * self.sampling_rate) for waveform in waveforms: if waveform.ndim != 1 or not waveform.is_floating_point() or not torch.isfinite(waveform).all(): raise ValueError("Each waveform must be a one-dimensional finite floating-point array.") waveform = waveform.to(dtype=torch.float32) if source_rate != self.sampling_rate: waveform = torchaudio.functional.resample(waveform, source_rate, self.sampling_rate) if waveform.numel() < 1025: raise ValueError("Each waveform must contain at least 1025 samples at 24 kHz.") if waveform.numel() > maximum: raise ValueError("Audio exceeds one model window; use model.transcribe for whole songs.") prepared.append(waveform) if len({str(value.device) for value in prepared}) != 1: raise ValueError("All waveforms in a batch must be on the same device.") if padding is False: length = max(value.numel() for value in prepared) if any(value.numel() != length for value in prepared): raise ValueError("Use padding=True for waveforms of different lengths.") elif padding is True or padding == "max_length": length = maximum elif padding == "longest": length = max(value.numel() for value in prepared) else: raise ValueError("padding must be True, False, 'max_length', or 'longest'.") lengths = torch.tensor([value.numel() for value in prepared], device=prepared[0].device) values = torch.stack([torch.nn.functional.pad(value, (0, length - value.numel())) for value in prepared]) data = {"input_values": values} if return_attention_mask: data["attention_mask"] = (torch.arange(length, device=values.device)[None] < lengths[:, None]).long() if return_tensors == "np": data = {key: value.cpu().numpy() for key, value in data.items()} elif return_tensors not in {None, "pt"}: raise ValueError("return_tensors must be 'pt', 'np', or None.") return BatchFeature(data=data)
def decode(self, token_ids, strict=True): return self.tokenizer.decode_sequence(token_ids, strict=strict)
def batch_decode(self, sequences, strict=True): return [self.decode(tokens, strict=strict) for tokens in sequences]
SheetSage2Processor.register_for_auto_class()MANIFEST.tsv+8
SHA256SUMS+8
checkpoints/SheetSage2/README.mdAdded+234
checkpoints/SheetSage2/benchmark_results.jsonAdded+464
checkpoints/SheetSage2/benchmarks/jaah.mdAdded+38
checkpoints/SheetSage2/benchmarks/jaah_per_song.csvAdded
checkpoints/SheetSage2/benchmarks/jaah_results.jsonAdded+219
checkpoints/SheetSage2/benchmarks/jaah_statistics.jsonAdded+62
checkpoints/SheetSage2/modeling_sheetsage2.pyAdded+448
checkpoints/SheetSage2/processing_sheetsage2.pyAdded+109