Note / 说明: This repository (files and this model card) was prepared and uploaded by Claude, an AI assistant made by Anthropic, on behalf of the account owner. It is not an official release of the YourMT3 authors; they have been informed in a discussion on mimbres/YourMT3. If the authors ask, the files will be changed or taken down. 本仓库(文件与模型卡)由 Anthropic 的 AI 助手 Claude 代账号所有者整理并上传,不是 YourMT3 作者的官方发布;已在 mimbres/YourMT3 的讨论区告知原作者,作者如有要求会修改或撤下。
YourMT3+ 多乐器自动扒谱模型的 非官方 ONNX 导出,checkpoint 为 HF Space 默认的 YPTF.MoE+Multi (noPS)(mc13_256_g4_all_v7_mt3f_sqr_rms_moe_wf4_n8k2_silu_rope_rp_b36_nops/last.ckpt)。权重数值未改动。用 onnxruntime 就能在 CPU 上把音频转成多乐器 MIDI(含鼓),不需要 PyTorch。导出者与原作者无关。
Sungkyun Chang、Emmanouil Benetos、Holger Kirchhoff、Simon Dixon,YourMT3+: Multi-instrument Music Transcription with Enhanced Transformer Architectures and Cross-dataset Stem Augmentation,MLSP 2024,arXiv:2407.04822。权重:https://huggingface.co/mimbres/YourMT3;代码:https://huggingface.co/spaces/mimbres/YourMT3(amt/src)、https://github.com/mimbres/YourMT3。
| 文件 | 大小 | 说明 |
|---|---|---|
encoder.onnx |
97.4 MB | 频谱 → 前置卷积 → PerceiverTF (MoE) → 13 通道投影 → 8 层解码器的交叉注意力 K/V |
decoder_step.onnx |
92.8 MB | 单步解码(自注意力 KV 缓存进出),输出 argmax、logits、本步 K/V |
vocab.json |
12 KB | 事件词表、乐器表(program → 类别) |
NOTICE.md |
— | 出处与协议 |
*.py |
— | 导出、核对与参考推理脚本 |
| fp32,合计约 181 MB。 |
event2note 等逐条对应)。同一首 212 s 歌:onnxruntime(Python)token 序列 1351/1352 段 × 通道相同(唯一差异是一处近似平票),音符 1506/1507 相同;C# 实现 1352/1352、1507/1507 完全相同。
约 0.180.21 倍实时(200 s 的歌 4060 s,批 4、12 线程);进程峰值内存约 2.7~2.8 GB。PyTorch 原版同歌 94 s。
| 数据 | 本模型 | Basic Pitch 直接 | Basic Pitch 先 Spleeter 分离 |
|---|---|---|---|
| Slakh2100-redux 测试集 10 首(多乐器) | 0.817(多乐器 F 0.900) | 0.465 | 0.478 |
| Slakh 鼓(任意鼓件) | 0.903 | — | 0.540(Onsets and Frames 鼓模型) |
| Slakh 贝斯 | 0.951 | — | 0.454 |
| MAESTRO v3 test 4 首(钢琴) | 0.955 | 0.600 | 0.593 |
| GuitarSet 6 段(可能含训练曲目) | 0.914 | 0.791 | 0.531 |
| vocadito 8 段(无伴奏独唱) | 0.444 | 0.419 | 0.347 |
| 带偏移 F、每曲明细未随本仓库发布。另在 4 首有版权的流行歌(YOASOBI《群青》、Mili《world.execute(me);》、《初音ミクの消失》、洛天依 / 言和《达拉崩吧》)上做了无真值的一致性检查:同曲重复跑完全一致;人声轨与先分离人声的一致度 0.08~0.62;在芯片音乐和单件合成钢琴伴奏上本模型会编出不存在的乐器,Basic Pitch 更稳。这些歌的音频、MIDI 不随本仓库提供。 |
import json, numpy as np, onnxruntime as ort
from ort_infer import spectrogram_np # 本仓库附带:双精度频谱
enc = ort.InferenceSession("encoder.onnx"); dec = ort.InferenceSession("decoder_step.onnx")
vocab = json.load(open("vocab.json", encoding="utf-8"))
# 1) 16 kHz 单声道,每段 32767 样本(≈2.05 s)→ spectrogram_np → spec (B, 110, 1024) float32
# 2) enc.run(None, {"spec": spec}) → ck_0..7 (B·13, 6, 64, 110)、cv_0..7 (B·13, 6, 110, 64)
# 3) decoder_step:输入 ids (N) int64、pos (1) int64、pk_i (N,6,64,S)、pv_i (N,6,S,64)、ck_i、cv_i
# 输出 next_id (N)、logits (N,596)、nk_i (N,6,64)、nv_i (N,6,64);调用方把 nk/nv 写进缓存第 pos 格
# 第 0 步喂 BOS=0,第 0 步的输出不判 EOS,之后出 EOS=1 的行结束,最多 256 步
# 4) 事件码 → 音符(时间、音高、program、鼓),按 vocab["programs"] 的乐器表分轨写 MIDI
完整参考实现见 ort_infer.py;导出与核对脚本:export_onnx.py、export_vocab.py、verify_onnx.py、ymt3_common.py(需要原版 Space 代码 amt/src 和 checkpoint,放在脚本旁的 upstream/ 下)。
感谢 Sungkyun Chang 及合作者公开 YourMT3+ 的论文、代码与 Apache-2.0 权重。导出思路参考了 OwnAudioSharp.Mt3(MIT)拆分 MT3 编解码器的做法。
An unofficial ONNX export of YourMT3+, checkpoint YPTF.MoE+Multi (noPS) (the HF Space default). Weights are unchanged. It transcribes audio to multi-instrument MIDI (including drums) on CPU with onnxruntime, no PyTorch needed. The exporter is not affiliated with the original authors.
Sungkyun Chang, Emmanouil Benetos, Holger Kirchhoff, Simon Dixon. YourMT3+: Multi-instrument Music Transcription with Enhanced Transformer Architectures and Cross-dataset Stem Augmentation, MLSP 2024, arXiv:2407.04822.
encoder.onnx (97.4 MB), decoder_step.onnx (92.8 MB), vocab.json (12 KB), NOTICE.md. fp32, ~181 MB total.
event2note).On a 212 s song: onnxruntime (Python) 1351/1352 token sequences and 1506/1507 notes identical; a C# implementation 1352/1352 and 1507/1507 identical.
~0.18–0.21× real time (40–60 s for a 200 s song, batch 4, 12 threads); peak process memory ~2.7–2.8 GB.
| Data | This model | Basic Pitch | Basic Pitch after Spleeter |
|---|---|---|---|
| Slakh2100-redux test, 10 songs | 0.817 (multi-instrument F1 0.900) | 0.465 | 0.478 |
| Slakh drums (any piece) | 0.903 | — | 0.540 |
| Slakh bass | 0.951 | — | 0.454 |
| MAESTRO v3 test, 4 pieces | 0.955 | 0.600 | 0.593 |
| GuitarSet, 6 excerpts (may overlap training) | 0.914 | 0.791 | 0.531 |
| vocadito, 8 a-cappella excerpts | 0.444 | 0.419 | 0.347 |
| Consistency checks (no ground truth) on four copyrighted pop songs (titles only; no audio/MIDI/lyrics are distributed): deterministic across runs; vocal-track agreement with a separate-then-transcribe pipeline 0.08–0.62; on chiptune and on a single synthesized piano accompaniment the model hallucinates instruments and Basic Pitch is more stable. |
Weak on singing voice; under-detects bass in real recordings; hallucinated instruments on chiptune / single synthetic instruments; slow on CPU with ~2.7 GB memory; not quantized; only one checkpoint exported.
See the Python sketch in the Chinese section (input/output names included) and the reference implementation ort_infer.py. Export / verification scripts: export_onnx.py, export_vocab.py, verify_onnx.py, ymt3_common.py (they need the original Space code amt/src and the checkpoint under upstream/).
Thanks to Sungkyun Chang and co-authors for publishing YourMT3+ with Apache-2.0 weights. The encoder/decoder split follows the approach of OwnAudioSharp.Mt3 (MIT).
encoder.onnx 97 MBdecoder_step.onnx 93 MBmimbres/YourMT3