S-KEY: verified end-to-end ONNX
OpenMIRLab's FP32 ONNX export of Deezer's S-KEY (Kong et al., ICASSP 2025). The graph includes the VQT frontend and predicts a global musical key.
Contract
| Tensor | Type and shape | Meaning |
|---|---|---|
audio |
float32 [1, samples] |
Mono waveform at 22050 Hz; dynamic sample count |
probs |
float32 [1, 24] |
Softmax probabilities in the fixed order below |
One audio item per call. Decode, mix to mono and resample before invocation;
no spectrogram frontend is required in the consumer. ONNX opset 17,
legacy Torch exporter (dynamo=False), no external-data sidecars.
The contract is unchanged from the supplied browser export.
| Index | Key | Index | Key |
|---|---|---|---|
| 0 | A major | 12 | B minor |
| 1 | Bb major | 13 | C minor |
| 2 | B major | 14 | C# minor |
| 3 | C major | 15 | D minor |
| 4 | C# major | 16 | D# minor |
| 5 | D major | 17 | E minor |
| 6 | D# major | 18 | F minor |
| 7 | E major | 19 | F# minor |
| 8 | F major | 20 | G minor |
| 9 | F# major | 21 | G# minor |
| 10 | G major | 22 | A minor |
| 11 | G# major | 23 | Bb minor |
Verification scope and known limitation
Acceptance is short music fixture parity, not universal numerical equivalence.
The first 10 and 30 seconds of the inference repo's existing piano fixture were
compared against a separately loaded, fresh, unpatched
load_model_components(checkpoint, cpu) pipeline. Both must preserve argmax and
have maximum absolute probability difference <= 1e-4. Extra audio supplied
to the exporter adds the same gates; it cannot replace the baselines.
| Music fixture | Native ONNX Runtime max abs probability error | Chromium WASM error | Key equal |
|---|---|---|---|
| First 10 seconds | 8.940696716308594e-7 | 2.086162567138672e-6 | Yes, index 6 |
| First 30 seconds | 5.662441253662109e-7 | 1.1622905731201172e-5 | Yes, index 6 |
Browser verification used Chromium 150, onnxruntime-web 1.23.2 and WASM. These are two excerpts of one recording; they do not establish corpus-wide accuracy. Earlier supplied 15-track/GiantSteps results were not rerun for this publication and are not claimed as new verification.
Pure-tone limitation: generated 4/8/13-second chords yield probability
errors about 0.000526 / 0.001021 / 0.000293, although their keys remain equal.
VQT lowpass floating-point accumulation differs between PyTorch and ONNX
Runtime; low-energy logarithms amplify that difference. These fixtures remain
real rejection regressions. If such an input is supplied for export verification,
the exporter refuses final output and preserves any existing destination.
The ONNX inference graph itself returns probabilities; it does not perform a
runtime PyTorch parity check or reject pure tones automatically.
known-limits.json retains exact measurements and input sample hashes.
No tolerance was relaxed and no CPU-specific convolution emulation was adopted.
The existing source MP3 has no recording-specific performer/license attribution;
it is not redistributed in this model repository. Its pinned source hash,
excerpt sample hashes and decoder identities are in verification.json.
Provenance and reproduction
- Upstream: deezer/skey, commit
80d9590e150b836a341dfc6dbf05aa20bc81d10b. - Inference/export source: openmirlab/skey-infer, commit
978f6bc72fbe6bf84e486ec91087d5632029ccba; source PR, merged asd29c7ebf2118be259a8d19d4a65acd74277d80fe. All Python 3.10β3.13 installed-wheel jobs and the pinned CPU ONNX job passed. - Checkpoint: upstream
skey/models/skey.pt, 765465 bytes, SHA-25678dfd0ad4fa9434bf7cec70a25934b7c575bda9c80e994700140770ad3a5ead4; the bundled file was checked byte-for-byte against upstream. - Fixture introduced upstream at
214758b9178f26abe7c5212d3122f8412d8cd2e3; the complete source checkout is required. Exporter and music fixture are excluded from wheel/sdist. - Export ran on CPU with Python 3.13.5, Torch 2.7.1+cu126, torchaudio 2.7.1, ONNX 1.19.1, ONNX Runtime 1.23.2, NumPy 2.5.1, nnAudio 0.3.4, soundfile 0.14.0 and libsndfile 1.2.2. Full receipt includes the clean source identity and two CPU threads.
After checking out the source commit and preparing its uv environment, the publication export command (from the repository root) was:
OMP_NUM_THREADS=2 MKL_NUM_THREADS=2 uv run --no-sync \
--with onnx==1.19.1 --with onnxruntime==1.23.2 \
python tools/export_onnx.py /tmp/skey.onnx > /tmp/verification.json
The local execution selected that same prepared environment through
--project <prepared-checkout> and set PYTHONPATH to this source checkout;
those machine-specific paths are omitted above. Optional tool dependencies do
not enter the ordinary Python runtime install.
Only the export copy receives two eval-mode identity rewrites:
- Fourteen non-affine
layer_norm(x, x.shape[1:])operations become explicit mean/variance reductions over(1, 2, 3), epsilon1e-5. This avoids a dynamic normalized-shape export limitation. - After verifying that the octave pool leaves 12 bins,
AdaptiveAvgPool2d((12, 1))becomes a mean over time. This avoids a dynamic adaptive-pooling export limitation without changing the 12-bin contract.
The reference and ordinary inference classes remain unpatched. The resulting ONNX is byte-identical to the previously supplied 328055-byte artifact.
Files and immutable consumption
| File | Bytes | SHA-256 |
|---|---|---|
skey.onnx |
328055 | 3255ada85908d37cc7ba2820e03637cab66558e5748f17542cefb7c9074fea88 |
verification.json |
2909 | fa5b94546c4ede8be2a2d5b3055483a63c895c452a52e98ed76e934ea58984a3 |
known-limits.json |
1022 | 266c57dbc5fbdd8a91a3f0dfc728f42b2f827640246ef389ec5ba6da815ba20b |
LICENSE |
1076 | 2087d50b26616ddb94416f4f18f173ea40bd6614b132316ed515dfe22a4e066d |
A final external publication receipt records every file's hash, including
this model card and the Hub-generated .gitattributes, without circular
self-hashing. Consumers must pin the full Hugging Face commit, never main:
https://huggingface.co/openmirlab/skey-onnx/resolve/<full-commit>/skey.onnx
Verify SHA-256 before opening the graph. Any later export gets a new commit and new pinned URL. Organization-owned Hugging Face hosting follows OpenMIRLab's derived-artifact policy; no hosting exception or Python package redistribution change is needed.
License and citation
MIT, Copyright (c) 2019-present, Deezer SA. The original notice is preserved in
LICENSE. Cite the original research:
@INPROCEEDINGS{kongskey2025,
author={Kong, Yuexuan and Meseguer-Brocal, Gabriel and Lostanlen, Vincent and Lagrange, Mathieu and Hennequin, Romain},
booktitle={ICASSP 2025 - 2025 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
title={S-KEY: Self-supervised Learning of Major and Minor Keys from Audio},
year={2025},
pages={1-5},
doi={10.1109/ICASSP49660.2025.10890222}}