ONNX export, int8 weights, model card
Browse files- LICENSE +21 -0
- README.md +102 -0
- mrx.int8.onnx +3 -0
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2023 Mitsubishi Electric Research Laboratories (MERL)
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: onnx
|
| 4 |
+
pipeline_tag: audio-to-audio
|
| 5 |
+
tags:
|
| 6 |
+
- audio
|
| 7 |
+
- source-separation
|
| 8 |
+
- cinematic-audio-source-separation
|
| 9 |
+
- onnx
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# MRX, ONNX (int8 weights)
|
| 13 |
+
|
| 14 |
+
MRX (Petermann, Wichern, Wang, Le Roux, "The Cocktail Fork Problem: Three-Stem Audio Separation for Real-World
|
| 15 |
+
Soundtracks", ICASSP 2022, [arXiv:2110.09958](https://arxiv.org/abs/2110.09958)): magnitudes at three STFT resolutions
|
| 16 |
+
into one hidden layer, a BLSTM per source, a real mask per source and resolution; 30.5 M parameters, MERL's own
|
| 17 |
+
checkpoint trained on Divide and Remaster with the SNR loss. It splits a soundtrack into three stems: dialogue, music,
|
| 18 |
+
effects. This is the network between its STFTs and iSTFTs, as
|
| 19 |
+
[@audio/neural-separate](https://github.com/audiojs/neural/tree/main/packages/neural-separate) runs it (`model: 'mrx'`).
|
| 20 |
+
|
| 21 |
+
| File | Size | SHA-256 |
|
| 22 |
+
|---|---|---|
|
| 23 |
+
| `mrx.int8.onnx` | 31.3 MB (31,287,081 bytes) | `d876c92d224f5d8cd2207d528b23369da895a6de71fb24132416fcb16f9f8424` |
|
| 24 |
+
|
| 25 |
+
The float32 export it is made from is 122.3 MB; float16 weights would be 61.5 MB.
|
| 26 |
+
|
| 27 |
+
## Source
|
| 28 |
+
|
| 29 |
+
- Model, code and checkpoint: [merlresearch/cocktail-fork-separation](https://github.com/merlresearch/cocktail-fork-separation)
|
| 30 |
+
at `19b3de827ebc4bfb014570cf92dd32b4ee3b6921`: `mrx.py`, `checkpoints/default_mrx_pre_trained_weights.pth`.
|
| 31 |
+
|
| 32 |
+
## Licence and attribution
|
| 33 |
+
|
| 34 |
+
MIT, Copyright (c) 2023 Mitsubishi Electric Research Laboratories (MERL) ([LICENSE](LICENSE)). The repository's
|
| 35 |
+
[`.reuse/dep5`](https://github.com/merlresearch/cocktail-fork-separation/blob/19b3de827ebc4bfb014570cf92dd32b4ee3b6921/.reuse/dep5)
|
| 36 |
+
names the checkpoints:
|
| 37 |
+
|
| 38 |
+
> Files: checkpoints/default_mrx_pre_trained_weights.pth [and its three other checkpoints]
|
| 39 |
+
> Copyright: 2023 Mitsubishi Electric Research Laboratories (MERL)
|
| 40 |
+
> License: MIT
|
| 41 |
+
|
| 42 |
+
MRX by Darius Petermann, Gordon Wichern, Zhong-Qiu Wang and Jonathan Le Roux (MERL); ONNX export and compaction by
|
| 43 |
+
audiojs. Trained on Divide and Remaster v2, whose music and effects come from FMA and FSD50K clips, each under its own
|
| 44 |
+
licence, some non-commercial.
|
| 45 |
+
|
| 46 |
+
```bibtex
|
| 47 |
+
@inproceedings{petermann2022cocktail,
|
| 48 |
+
title = {The Cocktail Fork Problem: Three-Stem Audio Separation for Real-World Soundtracks},
|
| 49 |
+
author = {Petermann, Darius and Wichern, Gordon and Wang, Zhong-Qiu and Le Roux, Jonathan},
|
| 50 |
+
booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
|
| 51 |
+
year = {2022},
|
| 52 |
+
eprint = {2110.09958},
|
| 53 |
+
archivePrefix = {arXiv}
|
| 54 |
+
}
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## Graph
|
| 58 |
+
|
| 59 |
+
Each channel apart (B), any length (T frames):
|
| 60 |
+
|
| 61 |
+
| | name | shape | |
|
| 62 |
+
|---|---|---|---|
|
| 63 |
+
| input | `mag_1024`, `mag_2048`, `mag_8192` | [B, 513, T], [B, 1025, T], [B, 4097, T] | magnitude STFTs: Hann windows of 1024, 2048, 8192, hop 256, scaled by 1/√n, centered with reflect padding, at 44.1 kHz |
|
| 64 |
+
| output | `mask_1024`, `mask_2048`, `mask_8192` | [B, 3, F, T] | a real mask per source (music, speech, sfx) and resolution |
|
| 65 |
+
|
| 66 |
+
A source is the sum over resolutions of the iSTFT of its mask times that resolution's spectrogram; the input is set to
|
| 67 |
+
-27 LUFS first and the stems scaled back (upstream's `separate.py`); @audio/neural-separate runs it in 20 s chunks.
|
| 68 |
+
|
| 69 |
+
```js
|
| 70 |
+
import separate from '@audio/neural-separate'
|
| 71 |
+
let { stems } = await separate([mono], { sampleRate: 48000, model: 'mrx' }) // stems.dialogue, .music, .effects
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
## Export, compaction, verification
|
| 75 |
+
|
| 76 |
+
`scripts/export-mrx.py --verify` exports the network and compares the sources rebuilt from the graph with
|
| 77 |
+
`MRX.forward` on noise and tones: max |diff| ≤ 1.2e-6 of max |y|; the package's pipeline matches upstream's
|
| 78 |
+
`separate_soundtrack` to 101–134 dB SNR per stem. `scripts/compact.py --model mrx --calibrate <a Divide and Remaster v3
|
| 79 |
+
tuning clip>` makes this file from it:
|
| 80 |
+
|
| 81 |
+
- Weights: all 39 stored in int8 (symmetric, a scale per output channel, an LSTM's per gate row and direction): rounded
|
| 82 |
+
together they move the masked spectra 40.4 dB under their power on the calibration clip, within the 40 dB the
|
| 83 |
+
script allows before keeping any in float16.
|
| 84 |
+
- Computed in float32 on every backend: each weight is Cast and multiplied by its scale in the graph, which onnxruntime
|
| 85 |
+
folds at load (the session holds float32 weights).
|
| 86 |
+
- Node and value names shortened (its input length is free, so nothing is folded).
|
| 87 |
+
- Against the export on the calibration clip: max |diff| 9.9e-3 of max |y|, SNR 40.4 dB (the worst resolution).
|
| 88 |
+
|
| 89 |
+
## Quality
|
| 90 |
+
|
| 91 |
+
30 clips of Divide and Remaster v3's English test set (every 40th of its 1200 clips of 60 s; Watcharasupat, Wu, Orife,
|
| 92 |
+
2024, CC BY-SA 4.0): each stem against its reference over the whole clip, SNR, the median over clips, dB:
|
| 93 |
+
|
| 94 |
+
| | dialogue | music | effects |
|
| 95 |
+
|---|---|---|---|
|
| 96 |
+
| export (float32) | 10.92 | 5.17 | 5.72 |
|
| 97 |
+
| this file | 10.92 | 5.17 | 5.70 |
|
| 98 |
+
| change per clip: median · the clip that lost most | +0.00 · −0.01 | +0.00 · −0.04 | +0.00 · −0.02 |
|
| 99 |
+
|
| 100 |
+
SI-SDR (mean over clips) 9.819 · 2.804 · 3.275 against the export's 9.815 · 2.805 · 3.273. Remixes (a stem 6 dB up or
|
| 101 |
+
down, against the true remix): dialogue +6 dB, music −6 dB, effects −6 dB each within 0.03 dB of the export's median,
|
| 102 |
+
no clip lower by more than 0.04 dB. Float16 weights (61.5 MB) change no median by more than 0.001 dB.
|
mrx.int8.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d876c92d224f5d8cd2207d528b23369da895a6de71fb24132416fcb16f9f8424
|
| 3 |
+
size 31287081
|