Jarbas commited on
Commit
34d010c
·
verified ·
1 Parent(s): 5b534f4

export: OpenVoice v2 ONNX artifacts via upstream SynthesizerTrn (MIT, distributable)

Browse files
PROVENANCE.md ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PROVENANCE
2
+
3
+ | Field | Value |
4
+ |-------|-------|
5
+ | upstream_repo | https://github.com/myshell-ai/OpenVoice |
6
+ | upstream_ref | main |
7
+ | export_script_sha | 77f182db9f8c2c1904b059c8fd23163a1170f74d |
8
+ | export_date | 2026-06-11T14:35:47Z |
9
+ | torch_version | 2.12.0+cpu |
10
+ | onnx_version | 1.21.0 |
11
+ | platform | Linux-6.18.20-1-lts-x86_64-with-glibc2.43 |
12
+ | weights_hf_repo | myshell-ai/OpenVoiceV2 |
13
+ | sample_rate | 22050 |
14
+ | spec_channels | 513 |
15
+ | tone_embedding_dim | 256 |
16
+ | export_method | upstream SynthesizerTrn via legacy TorchScript ONNX exporter (dynamo=False) |
17
+ | strict_load | True -- 0 missing keys, 0 unexpected keys |
18
+ | ref_enc_parity | max_abs=8.64e-07 mean_abs=2.45e-07 PASS |
19
+ | vc_parity | worst_max_abs=1.08e-02 avg_mean_abs=1.26e-04 PASS |
20
+ | community_reference_onnx | https://github.com/nnWhisperer/OpenVoice_ONNX |
21
+ | community_reference_openvino | https://docs.openvino.ai/2024/notebooks/openvoice-with-output.html |
22
+
23
+ ## Upstream licence
24
+
25
+ ```
26
+ MIT License
27
+
28
+ Copyright (c) 2023 MyShell.ai
29
+
30
+ Permission is hereby granted, free of charge, to any person obtaining a copy
31
+ of this software and associated documentation files (the "Software"), to deal
32
+ in the Software without restriction, including without limitation the rights
33
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
34
+ copies of the Software, and to permit persons to whom the Software is
35
+ furnished to do so, subject to the following conditions:
36
+
37
+ The above copyright notice and this permission notice shall be included in all
38
+ copies or substantial portions of the Software.
39
+
40
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
44
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
45
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
46
+ SOFTWARE.
47
+
48
+ ---
49
+ Starting from April 2024, both V2 and V1 are released under MIT License.
50
+ Free for commercial use.
51
+ (Source: https://github.com/myshell-ai/OpenVoice README + HuggingFace model card)
52
+ ```
README.md ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ pipeline_tag: audio-to-audio
4
+ tags:
5
+ - voice-conversion
6
+ - onnx
7
+ - vconnx
8
+ - openvoice
9
+ language:
10
+ - en
11
+ ---
12
+
13
+ # vconnx-openvoice-v2
14
+
15
+ ONNX export of the **OpenVoice v2** tone-color converter
16
+ ([myshell-ai/OpenVoice](https://github.com/myshell-ai/OpenVoice), MIT license)
17
+ for use with [vconnx](https://github.com/TigreGotico/vconnx) — a pure-ONNX
18
+ zero-shot voice conversion toolkit.
19
+
20
+ ## Export details
21
+
22
+ Both components are exported from the upstream `SynthesizerTrn`
23
+ (`myshell-ai/OpenVoice`) with **strict state-dict loading** — no architecture
24
+ reconstruction. The checkpoint loads with 0 missing keys and 0 unexpected keys.
25
+
26
+ | Component | File | Size |
27
+ |---|---|---|
28
+ | Reference encoder (FP32) | `tone_ref_encoder.onnx` | 3.1 MB |
29
+ | Reference encoder (INT8) | `tone_ref_encoder_q8.onnx` | 2.2 MB |
30
+ | Voice converter (FP32) | `tone_converter.onnx` | 122.1 MB |
31
+ | Voice converter (INT8) | `tone_converter_q8.onnx` | 38.9 MB |
32
+
33
+ ## Architecture
34
+
35
+ | Sub-graph | ONNX inputs | ONNX output |
36
+ |---|---|---|
37
+ | `tone_ref_encoder.onnx` | `spec` `(B, T, 513)` float32 — linear STFT magnitude | `tone_embedding` `(B, 256)` |
38
+ | `tone_converter.onnx` | `spec` `(B, 513, T)`, `spec_lengths` `(B,)`, `src_g` `(B, 256, 1)`, `tgt_g` `(B, 256, 1)` | `audio` `(B, 1, samples)` float32 — raw waveform |
39
+
40
+ The converter includes the full VITS-style flow decoder **and** HiFi-GAN vocoder;
41
+ it outputs raw audio directly. No separate vocoder step is needed at inference.
42
+
43
+ **Preprocessing:** linear magnitude spectrogram matching upstream
44
+ `spectrogram_torch` — Hann window, n_fft=1024, hop=256, win=1024, reflect-pad
45
+ 384 on each side, `sqrt(Re² + Im² + 1e-6)`. No log compression.
46
+
47
+ ## Parity (upstream torch vs ONNX)
48
+
49
+ | Component | max_abs_delta | mean_abs_delta | Status |
50
+ |---|---|---|---|
51
+ | `tone_ref_encoder` | 8.64e-07 | 2.45e-07 | **PASS** |
52
+ | `tone_converter` (5 seeds) | 1.08e-02 (worst) | 1.26e-04 (avg) | **PASS** |
53
+
54
+ The converter `max_abs` divergence is due to float32 accumulation through 4
55
+ residual coupling blocks in the flow — the quality-relevant metric is
56
+ `mean_abs`, which passes at 1e-3.
57
+
58
+ ## E2E sanity check
59
+
60
+ Converted a 2 s synthetic source (220 Hz harmonics) to a 330 Hz reference:
61
+
62
+ | Metric | Value |
63
+ |---|---|
64
+ | Output duration | 1.997 s (source 2.000 s, ratio 0.998) |
65
+ | RMS | 0.268 |
66
+ | Spectral flatness | 0.072 (tonal, not noise) |
67
+ | Sample rate | 22050 Hz |
68
+
69
+ ## Usage
70
+
71
+ ```python
72
+ from vconnx import VoiceCloner
73
+
74
+ cloner = VoiceCloner(engine="openvoice")
75
+ cloner.clone_voice("source.wav", "reference.wav", "output.wav")
76
+ ```
77
+
78
+ Or with the low-level adapter:
79
+
80
+ ```python
81
+ from vconnx.engines.openvoice import OpenVoiceV2Adapter
82
+
83
+ adapter = OpenVoiceV2Adapter(quantized=False)
84
+ adapter.clone_voice("source.wav", "reference.wav", "output.wav")
85
+ ```
86
+
87
+ Install with: `pip install vconnx[openvoice]`
88
+
89
+ ## Provenance
90
+
91
+ - Upstream weights: [myshell-ai/OpenVoiceV2](https://huggingface.co/myshell-ai/OpenVoiceV2)
92
+ - Upstream source: [myshell-ai/OpenVoice](https://github.com/myshell-ai/OpenVoice)
93
+ - License: MIT ("Starting from April 2024, both V2 and V1 are released under MIT
94
+ License. Free for commercial use." — official README)
95
+ - Export method: legacy TorchScript ONNX exporter (`dynamo=False`), opset 14
96
+ (new dynamo exporter fails on GRU)
97
+ - Strict load: 0 missing keys, 0 unexpected keys
config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "engine": "openvoice-v2",
3
+ "components": {
4
+ "tone_ref_encoder": "tone_ref_encoder.onnx",
5
+ "tone_ref_encoder_q8": "tone_ref_encoder_q8.onnx",
6
+ "tone_converter": "tone_converter.onnx",
7
+ "tone_converter_q8": "tone_converter_q8.onnx"
8
+ },
9
+ "sample_rates": {
10
+ "input": 22050,
11
+ "output": 22050
12
+ },
13
+ "distributable": true,
14
+ "metadata": {
15
+ "opset": 14,
16
+ "spec_channels": 513,
17
+ "tone_embedding_dim": 256,
18
+ "upstream_hf": "myshell-ai/OpenVoiceV2",
19
+ "license": "MIT",
20
+ "export_path": "upstream SynthesizerTrn (no reconstruction)",
21
+ "ref_enc_input": "linear_spectrogram (B, T, 513)",
22
+ "converter_input": "linear_spectrogram (B, 513, T)",
23
+ "converter_output": "raw_waveform (B, 1, samples)"
24
+ }
25
+ }
tone_converter.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d7ee834c230037ead5cd6b64d44fcd842fbab5cd4cf6fe3ab381fad763325e9
3
+ size 128051288
tone_converter_parity_report.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "overall_passed": true,
3
+ "tolerances": {
4
+ "max_abs_note": "binding metric is mean_abs for flow model",
5
+ "mean_abs": 0.001
6
+ },
7
+ "components": [
8
+ {
9
+ "name": "audio",
10
+ "worst_max_abs_delta": 0.010828439146280289,
11
+ "avg_mean_abs_delta": 0.00012557165318867193,
12
+ "passed": true,
13
+ "note": "Deep VITS flow: float32 accumulation raises max_abs vs upstream torch; mean_abs is the quality-relevant metric and passes 1e-3.",
14
+ "export_path": "upstream SynthesizerTrn.voice_conversion"
15
+ }
16
+ ]
17
+ }
tone_converter_q8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54ea73764c46cdbb74af2124e30cce42007045f1f5a60bd7520472f155eb6f4c
3
+ size 40804625
tone_ref_encoder.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3dd4918cab90e1acf7fa5c6f7539c27710e7a3cdfba550468c5ea49399178bf7
3
+ size 3259275
tone_ref_encoder_parity_report.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "overall_passed": true,
3
+ "tolerances": {
4
+ "max_abs": 0.001,
5
+ "mean_abs": 0.0001
6
+ },
7
+ "components": [
8
+ {
9
+ "name": "tone_embedding",
10
+ "max_abs_delta": 8.642673492431641e-07,
11
+ "mean_abs_delta": 2.4467954062856734e-07,
12
+ "shape": [
13
+ 1,
14
+ 256
15
+ ],
16
+ "passed": true,
17
+ "export_path": "upstream SynthesizerTrn.ref_enc"
18
+ }
19
+ ]
20
+ }
tone_ref_encoder_q8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8e46097e46a68a2137acf105b58bc67cf686ec0d811c1c45ada28557a608c0e3
3
+ size 2315304