Add files using upload-large-folder tool
Browse files- .gitattributes +5 -13
- README.md +315 -0
- artifacts/ascend_310p/vits_flow_decoder_dynamic_fp16.om +3 -0
- artifacts/ascend_310p/vits_flow_decoder_t639_fp16.om +3 -0
- artifacts/ascend_310p/vits_flow_decoder_t681_fp16.om +3 -0
- artifacts/onnx/vits_duration.onnx +3 -0
- artifacts/onnx/vits_flow_decoder.onnx +3 -0
- artifacts/onnx/vits_text_encoder_clean.onnx +3 -0
- assets/adapter.json +16 -0
- assets/default.yaml +185 -0
- assets/phone_id_map.txt +268 -0
- assets/reference_impl/run_vits_hybrid_310p.py +126 -0
- assets/reference_impl/synthesize_vits_310p.py +154 -0
- assets/snapshot_iter_150000.pdz +3 -0
- inference_manifest.json +508 -0
.gitattributes
CHANGED
|
@@ -3,33 +3,25 @@
|
|
| 3 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
*.tar filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 29 |
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 6 |
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 8 |
*.joblib filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
| 9 |
*.model filter=lfs diff=lfs merge=lfs -text
|
| 10 |
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 11 |
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 12 |
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 13 |
*.onnx filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 14 |
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 15 |
*.pb filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
| 16 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 17 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 18 |
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
| 19 |
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 21 |
*.tflite filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
| 22 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 23 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
artifacts/ascend_310p/vits_flow_decoder_dynamic_fp16.om filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
artifacts/ascend_310p/vits_flow_decoder_t639_fp16.om filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
artifacts/ascend_310p/vits_flow_decoder_t681_fp16.om filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
assets/snapshot_iter_150000.pdz filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pipeline_tag: text-to-speech
|
| 4 |
+
language:
|
| 5 |
+
- zh
|
| 6 |
+
tags:
|
| 7 |
+
- vits
|
| 8 |
+
- text-to-speech
|
| 9 |
+
- tts
|
| 10 |
+
- csmsc
|
| 11 |
+
- paddlespeech
|
| 12 |
+
- chinese
|
| 13 |
+
- robotics
|
| 14 |
+
- IB-Robot
|
| 15 |
+
- ascend
|
| 16 |
+
- edge-deployment
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# Model Card for VITS-CSMSC (IB-Robot, hybrid CPU + Ascend 310P)
|
| 20 |
+
|
| 21 |
+
PaddleSpeech VITS-CSMSC — single-speaker Mandarin text-to-speech, 22.05 kHz —
|
| 22 |
+
packaged for the [IB-Robot](https://atomgit.com/openeuler/IB_Robot) framework
|
| 23 |
+
as a **hybrid deployment**: the text encoder and duration predictor run as ONNX
|
| 24 |
+
on CPU, and the flow decoder (which contains the vocoder and dominates compute)
|
| 25 |
+
runs as an `.om` on Ascend 310P1.
|
| 26 |
+
|
| 27 |
+
This is the speech-output stage of the robot pipeline. Accepts arbitrary
|
| 28 |
+
Chinese text; the voice is the fixed CSMSC speaker.
|
| 29 |
+
|
| 30 |
+
## Deployments
|
| 31 |
+
|
| 32 |
+
| deployment | backend | flow artifact | frames | notes |
|
| 33 |
+
|---|---|---|---:|---|
|
| 34 |
+
| `ascend_310p` | ONNX CPU + Ascend ACL | `vits_flow_decoder_dynamic_fp16.om` | variable | **recommended**, any utterance length |
|
| 35 |
+
| `torch_cpu` | ONNX Runtime CPU | `artifacts/onnx/vits_flow_decoder.onnx` | variable | full CPU reference path |
|
| 36 |
+
|
| 37 |
+
Two fixed-shape flow decoders also ship in the repo without their own
|
| 38 |
+
deployment entry, matching the convention across this organisation that one
|
| 39 |
+
hardware target carries one deployment:
|
| 40 |
+
|
| 41 |
+
| file | frames | audio | notes |
|
| 42 |
+
|---|---:|---:|---|
|
| 43 |
+
| `vits_flow_decoder_t639_fp16.om` | 639 | 7.42 s | ~20 % lower flow latency than dynamic, 44 % of its size |
|
| 44 |
+
| `vits_flow_decoder_t681_fp16.om` | 681 | 7.91 s | second fixed-shape build |
|
| 45 |
+
|
| 46 |
+
Both are declared in `bundle.files` and load by pointing an ACL session at the
|
| 47 |
+
file directly. They accept **exactly** their frame count, so an utterance has
|
| 48 |
+
to be padded or trimmed to fit; the dynamic build takes any length, which is
|
| 49 |
+
why it is the one wired to `ascend_310p`. Accuracy for all three is in
|
| 50 |
+
[Validation](#validation) — they are within 1e-5 cosine of each other.
|
| 51 |
+
|
| 52 |
+
The `ascend_310p` row is a **composite deployment** in the manifest: there is no
|
| 53 |
+
single `runtime_profile`, because there is no single backend. `role_identities`
|
| 54 |
+
and `role_runtime_profiles` name the backend per role — `onnx` on CPU for
|
| 55 |
+
`text_encoder` and `duration`, `ascend`/`acl` for `flow_decoder`. `torch_cpu`
|
| 56 |
+
runs all three roles on ONNX Runtime and so keeps one shared profile.
|
| 57 |
+
|
| 58 |
+
The two host-side steps between duration and flow (`duration_expand_path`,
|
| 59 |
+
`sample_z_p`) are listed in each deployment's `metadata.host_stages`; they are
|
| 60 |
+
not model roles and have no artifact.
|
| 61 |
+
|
| 62 |
+
Shared contract: `tensor_model/vits/synthesize`
|
| 63 |
+
(`tts.phone_ids [1,-1] -> tts.audio [1,-1]`), preprocessing
|
| 64 |
+
`paddlespeech-zh-frontend-jieba-pypinyin-phoneid-v1`, output
|
| 65 |
+
`mono-float32-pcm-22050hz-v1`, logical revision
|
| 66 |
+
`paddlespeech-vits-csmsc@onnx-export-v1`.
|
| 67 |
+
|
| 68 |
+
`ascend_310p` uses the dynamic-shape flow decoder, so no padding or trimming
|
| 69 |
+
is needed. For latency-sensitive use with a known utterance length, load one of
|
| 70 |
+
the two fixed-shape builds above directly.
|
| 71 |
+
|
| 72 |
+
## Pipeline
|
| 73 |
+
|
| 74 |
+
```text
|
| 75 |
+
Chinese text
|
| 76 |
+
→ PaddleSpeech frontend / pypinyin → phone ids
|
| 77 |
+
→ text encoder (ONNX, CPU) → x, m_p, logs_p (192-d), x_mask
|
| 78 |
+
→ duration predictor (ONNX, CPU) → logw
|
| 79 |
+
→ host: alignment expansion + z_p (see below)
|
| 80 |
+
→ flow decoder (.om, Ascend 310P1) → waveform
|
| 81 |
+
→ 22.05 kHz mono wav
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
### Host stage (between duration and flow)
|
| 85 |
+
|
| 86 |
+
This is not a thin glue layer — it is part of the model's semantics and must be
|
| 87 |
+
reproduced exactly. See `assets/reference_impl/run_vits_hybrid_310p.py`:
|
| 88 |
+
|
| 89 |
+
```python
|
| 90 |
+
dur = ceil(exp(logw) * float32(x_mask)) # per-phone frame counts
|
| 91 |
+
path = generate_path(dur, ...) # [1, T_text, T_frames] alignment
|
| 92 |
+
m = (path.transpose @ m_p.transpose).transpose # expand to frames
|
| 93 |
+
logs = (path.transpose @ logs_p.transpose).transpose
|
| 94 |
+
y_mask = ones([1, 1, T_frames])
|
| 95 |
+
z_p = m + randn_like(m) * exp(logs) * 0.667 # noise_scale 0.667
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
The reference uses **seed 1234** for reproducibility; the sampling of `z_p` is
|
| 99 |
+
genuinely stochastic, so runs with different seeds produce different (equally
|
| 100 |
+
valid) audio, and bit-exact comparison against a reference requires pinning it.
|
| 101 |
+
|
| 102 |
+
## Tensor contract
|
| 103 |
+
|
| 104 |
+
```text
|
| 105 |
+
text encoder text int64 [1, -1] phone ids
|
| 106 |
+
text_lengths int64 [1]
|
| 107 |
+
→ x float32 [1, 192, -1] outputs are positional and
|
| 108 |
+
m_p float32 [1, 192, -1] come back in this order
|
| 109 |
+
logs_p float32 [1, 192, -1]
|
| 110 |
+
x_mask bool [1, 1, -1]
|
| 111 |
+
|
| 112 |
+
duration x float32 [1, 192, -1]
|
| 113 |
+
x_mask bool [1, 1, -1] bool, not float
|
| 114 |
+
→ logw float32 [1, 1, -1]
|
| 115 |
+
|
| 116 |
+
flow decoder z_p float32 [1, 192, T] T = 639 / 681 / -1
|
| 117 |
+
y_mask float32 [1, 1, T]
|
| 118 |
+
→ wav float32 [1, T*256] 256 samples per frame
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
Sample rate 22050 Hz, hop 256 → one frame ≈ 11.61 ms.
|
| 122 |
+
|
| 123 |
+
## Repository Structure
|
| 124 |
+
|
| 125 |
+
- `inference_manifest.json` �� deployment routing (schema v3)
|
| 126 |
+
- `assets/adapter.json` — adapter identity (`vits` / `synthesize`)
|
| 127 |
+
- `assets/phone_id_map.txt` — 268-entry phone→id map used by the frontend
|
| 128 |
+
- `assets/snapshot_iter_150000.pdz` — the upstream Paddle training checkpoint
|
| 129 |
+
(1.1 GB), byte-identical to the one in `vits_csmsc_ckpt_1.4.0.zip`
|
| 130 |
+
- `assets/default.yaml` — that checkpoint's own training config
|
| 131 |
+
- `assets/reference_impl/run_vits_hybrid_310p.py` — the hybrid runner, and the
|
| 132 |
+
normative source for the host stage above
|
| 133 |
+
- `assets/reference_impl/synthesize_vits_310p.py` — text → wav CLI
|
| 134 |
+
- `artifacts/onnx/*.onnx` — the three ONNX graphs (CPU stages + CPU reference)
|
| 135 |
+
- `artifacts/ascend_310p/*.om` — three flow decoder builds
|
| 136 |
+
|
| 137 |
+
## Source Model
|
| 138 |
+
|
| 139 |
+
Upstream is **PaddleSpeech VITS-CSMSC**, released checkpoint
|
| 140 |
+
**`vits_csmsc_ckpt_1.4.0`**. The manifest's logical revision is
|
| 141 |
+
`paddlespeech-vits-csmsc@onnx-export-v1` — it names the ONNX export this bundle
|
| 142 |
+
runs, not the upstream release tag, which is `1.4.0`.
|
| 143 |
+
|
| 144 |
+
```bash
|
| 145 |
+
wget https://paddlespeech.cdn.bcebos.com/Parakeet/released_models/vits/\
|
| 146 |
+
vits_csmsc_ckpt_1.4.0.zip
|
| 147 |
+
# 1,027,863,302 bytes
|
| 148 |
+
# sha256 994340036777b24f3bf02967bf37f570d40e5514b54ff0001c5b4732921ae064
|
| 149 |
+
```
|
| 150 |
+
|
| 151 |
+
The archive holds exactly three files, and **all three are shipped here
|
| 152 |
+
byte-for-byte** (sha256 verified against a fresh download and extraction):
|
| 153 |
+
|
| 154 |
+
| shipped as | in archive | bytes | sha256 |
|
| 155 |
+
|---|---|---:|---|
|
| 156 |
+
| `assets/snapshot_iter_150000.pdz` | `snapshot_iter_150000.pdz` | 1,116,898,380 | `ef0faad8186cdd1aa278b61e0b2a3cb7dee9216d1b84f1bc760ec887bcd935c7` |
|
| 157 |
+
| `assets/default.yaml` | `default.yaml` | 7,835 | `7eebdd044a663f2485b6abd54f6179e90da64c0c7c109778295f9a23be6dcbfc` |
|
| 158 |
+
| `assets/phone_id_map.txt` | `phone_id_map.txt` | 2,128 | `ca00d60618a00a2dc1e42002faaa9024c9e5057e04b1e834325950111cee59c3` |
|
| 159 |
+
|
| 160 |
+
`phone_id_map.txt` pins the phone inventory, and therefore the text frontend
|
| 161 |
+
contract, to this exact release. `default.yaml` is the checkpoint's own training
|
| 162 |
+
config and independently confirms the numbers this bundle's tensor contract
|
| 163 |
+
depends on: `fs: 22050`, `n_shift: 256` (the 256 samples per frame above) and
|
| 164 |
+
`hidden_channels: 192` (the 192-d `z_p`).
|
| 165 |
+
|
| 166 |
+
Shipping the checkpoint follows the convention in the rest of this
|
| 167 |
+
organisation, where the upstream weights live under `assets/`. Note that it is
|
| 168 |
+
**not** the artifact any deployment loads — every deployment runs the ONNX
|
| 169 |
+
graphs below. It is there so the bundle carries its own provenance.
|
| 170 |
+
|
| 171 |
+
The three ONNX graphs were exported from that checkpoint in separate passes,
|
| 172 |
+
which is why their opsets differ (12 / 13 / 11):
|
| 173 |
+
|
| 174 |
+
| file | bytes | opset | sha256 |
|
| 175 |
+
|---|---:|---:|---|
|
| 176 |
+
| `vits_text_encoder_clean.onnx` | 55,329,745 | 12 | `15c5fb01538ce38c4748c9bc5892fc0af9bee7c65b228cd116651237a3f72536` |
|
| 177 |
+
| `vits_duration.onnx` | 2,644,862 | 13 | `f75fd325801a62976ecea0f52ba03a384197f574fedf0486598e5c0fc840c89c` |
|
| 178 |
+
| `vits_flow_decoder.onnx` | 86,596,889 | 11 | `3cb9dfe036b843abce71b867626f23d60745c0f0f35f29787ecec7fbfaf0f7fa` |
|
| 179 |
+
| `vits_flow_decoder_t639_fp16.om` | 91,708,818 | — | `b7da515895536b7baf75314b908344164efb916ffc8cc2246c6dac0e4c4cf91b` |
|
| 180 |
+
| `vits_flow_decoder_t681_fp16.om` | 91,706,422 | — | `df192baf48cefb732f52945cd411d3c88bbd310cac784dc51e11a8a7ed0d2b61` |
|
| 181 |
+
| `vits_flow_decoder_dynamic_fp16.om` | 210,986,822 | — | `c8b26160a0bc7e4de987424fab228bcc8dfd3fb053bd910737443999412c40d8` |
|
| 182 |
+
|
| 183 |
+
Shipping the checkpoint does **not** make the ONNX byte-reproducible from it:
|
| 184 |
+
the export script is not part of this bundle, and PaddleSpeech static-model
|
| 185 |
+
export behaviour changed with PaddlePaddle ≥ 2.5. What *is* established is the
|
| 186 |
+
accuracy of the export — cosine `0.9999999999998159` against the Paddle
|
| 187 |
+
reference, below — plus the exact checkpoint and config it came from.
|
| 188 |
+
|
| 189 |
+
## Validation
|
| 190 |
+
|
| 191 |
+
All measured on a real Ascend 310P1, against ONNX Runtime CPU fp32.
|
| 192 |
+
|
| 193 |
+
**ONNX export vs Paddle reference** (text encoder + duration) — the export
|
| 194 |
+
itself is lossless:
|
| 195 |
+
|
| 196 |
+
```text
|
| 197 |
+
cosine 0.9999999999998159
|
| 198 |
+
max_abs 4.291534423828125e-06
|
| 199 |
+
```
|
| 200 |
+
|
| 201 |
+
**Flow decoder OM vs ONNX**, on the flow subgraph alone:
|
| 202 |
+
|
| 203 |
+
| build | cosine | max_abs | latency mean | p95 | subgraph RTF |
|
| 204 |
+
|---|---:|---:|---:|---:|---:|
|
| 205 |
+
| t639 | 0.9999842557218173 | 0.01094835 | 96.17 ms | 96.38 ms | 0.01296 |
|
| 206 |
+
| t681 | 0.9999692545131995 | 0.01450025 | 102.72 ms | — | 0.01299 |
|
| 207 |
+
|
| 208 |
+
Those are the conversion-time numbers. They have since been **independently
|
| 209 |
+
reproduced on the shipped artifacts** — same board, same `artifacts/onnx/
|
| 210 |
+
vits_flow_decoder.onnx` reference, but with `z_p` built through the real
|
| 211 |
+
encoder → duration → host-alignment path rather than synthetic tensors
|
| 212 |
+
(`_tools/board/verify_vits_flow_om_vs_onnx.py`):
|
| 213 |
+
|
| 214 |
+
| build | frames | cosine | max_abs | rel_l2 | latency mean | p95 | subgraph RTF |
|
| 215 |
+
|---|---:|---:|---:|---:|---:|---:|---:|
|
| 216 |
+
| t639 | 639 | 0.99998847 | 0.008860 | 0.00480 | 95.89 ms | 96.00 ms | 0.01292 |
|
| 217 |
+
| t681 | 681 | 0.99998923 | 0.008666 | 0.00464 | 102.47 ms | 102.71 ms | 0.01296 |
|
| 218 |
+
| dynamic | 399 | 0.99998542 | 0.006929 | 0.00540 | 77.32 ms | 77.90 ms | 0.01669 |
|
| 219 |
+
|
| 220 |
+
Latency matches the conversion report to within 0.3 ms on every build, and
|
| 221 |
+
accuracy comes out slightly *better* on realistic `z_p` than on the synthetic
|
| 222 |
+
input used at conversion time. The dynamic build's higher RTF at 399 frames is
|
| 223 |
+
the fixed per-call overhead spread over less audio, not a slower kernel — at
|
| 224 |
+
639 frames it lands within ~40 ms of the fixed build (see below).
|
| 225 |
+
|
| 226 |
+
**End-to-end hybrid pipeline**, 20 runs, 7.42 s of output audio. Measured with
|
| 227 |
+
the fixed **t639** build, which is what the reference runner loads
|
| 228 |
+
(`assets/reference_impl/run_vits_hybrid_310p.py:15`); the same pipeline on the
|
| 229 |
+
`ascend_310p` dynamic build is the `baseline` row two tables down, 367.63 ms:
|
| 230 |
+
|
| 231 |
+
```text
|
| 232 |
+
cosine_vs_onnx 0.9999853236698978
|
| 233 |
+
max_abs 0.008778512477874756
|
| 234 |
+
latency mean 327.38 ms p50 323.81 ms p95 355.89 ms
|
| 235 |
+
RTF 0.0441
|
| 236 |
+
```
|
| 237 |
+
|
| 238 |
+
Per-stage breakdown (mean, ms):
|
| 239 |
+
|
| 240 |
+
| stage | backend | ms | share |
|
| 241 |
+
|---|---|---:|---:|
|
| 242 |
+
| text encoder | ONNX CPU | 48.71 | 15% |
|
| 243 |
+
| duration | ONNX CPU | 25.38 | 8% |
|
| 244 |
+
| host alignment + z_p | numpy CPU | 156.64 | 48% |
|
| 245 |
+
| flow decoder | Ascend OM | 96.53 | 29% |
|
| 246 |
+
|
| 247 |
+
The host alignment stage is now the single largest cost — larger than the NPU
|
| 248 |
+
work it feeds. It is pure numpy (`generate_path` plus two matmuls) and is the
|
| 249 |
+
obvious next optimisation target; moving it onto the NPU or vectorising it
|
| 250 |
+
would cut end-to-end latency by roughly a third.
|
| 251 |
+
|
| 252 |
+
**Dynamic build, variable text length:**
|
| 253 |
+
|
| 254 |
+
| sample | phones | frames | audio | latency mean | RTF |
|
| 255 |
+
|---|---:|---:|---:|---:|---:|
|
| 256 |
+
| baseline | 101 | 639 | 7.4188 s | 367.63 ms | 0.04955 |
|
| 257 |
+
| new_text | 144 | 915 | 10.6231 s | 414.97 ms | 0.03906 |
|
| 258 |
+
|
| 259 |
+
Latency grows sub-linearly with length, so RTF improves on longer utterances.
|
| 260 |
+
The dynamic build costs ~40 ms over the fixed t639 build at the same length.
|
| 261 |
+
|
| 262 |
+
## Usage
|
| 263 |
+
|
| 264 |
+
```python
|
| 265 |
+
from inference_manifest import load_inference_manifest
|
| 266 |
+
|
| 267 |
+
validated = load_inference_manifest("models/vits-csmsc", "ascend_310p")
|
| 268 |
+
```
|
| 269 |
+
|
| 270 |
+
The hybrid path needs both an ONNX Runtime CPU session (encoder, duration) and
|
| 271 |
+
an ACL session (flow), plus the host stage between them — see
|
| 272 |
+
`assets/reference_impl/run_vits_hybrid_310p.py`, which is the normative
|
| 273 |
+
implementation.
|
| 274 |
+
|
| 275 |
+
## Known Limitations
|
| 276 |
+
|
| 277 |
+
- **Not a pure-NPU TTS.** Text encoder and duration remain on CPU; only the
|
| 278 |
+
flow decoder is compiled to OM.
|
| 279 |
+
- **Chinese only.** English and other languages are not a validation target.
|
| 280 |
+
- **Fixed speaker.** Single-speaker CSMSC voice, no speaker conditioning.
|
| 281 |
+
- **The two extra fixed-shape OMs require exact frame counts** (639 / 681).
|
| 282 |
+
The `ascend_310p` deployment uses the dynamic build and has no such limit;
|
| 283 |
+
the fixed builds are for callers who know their length and want the ~40 ms.
|
| 284 |
+
- Output is stochastic (`noise_scale = 0.667`) unless the RNG seed is pinned.
|
| 285 |
+
|
| 286 |
+
## Environment
|
| 287 |
+
|
| 288 |
+
Validated on: Ascend 310P1 with CANN and `ais_bench`, Python 3.11.6,
|
| 289 |
+
ONNX Runtime 1.23.2.
|
| 290 |
+
|
| 291 |
+
## License
|
| 292 |
+
|
| 293 |
+
Code and packaging: Apache-2.0. Model weights follow the upstream
|
| 294 |
+
[PaddleSpeech](https://github.com/PaddlePaddle/PaddleSpeech) license
|
| 295 |
+
(Apache-2.0); the CSMSC corpus is subject to its own terms.
|
| 296 |
+
|
| 297 |
+
## Citation
|
| 298 |
+
|
| 299 |
+
@inproceedings{vits2021,
|
| 300 |
+
title = {Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech},
|
| 301 |
+
author = {Kim, Jaehyeon and Kong, Jungil and Son, Juhee},
|
| 302 |
+
booktitle = {arXiv preprint arXiv:2106.06103},
|
| 303 |
+
year = {2021}
|
| 304 |
+
}
|
| 305 |
+
@article{paddlespeech2022,
|
| 306 |
+
title = {PaddleSpeech: An Easy-to-Use All-in-One Speech Toolkit},
|
| 307 |
+
author = {Zhang, Hui and Yuan, Tian and Chen, Junkun and Li, Xintong and Zheng, Renjie and Huang, Yuxin and Chen, Xiaojie and Gong, Enlei and Chen, Zeyu and Hu, Xiaoguang and Yu, Dianhai and Ma, Yanjun and Huang, Liang},
|
| 308 |
+
journal = {arXiv preprint arXiv:2205.12007},
|
| 309 |
+
year = {2022}
|
| 310 |
+
}
|
| 311 |
+
@software{ib_robot,
|
| 312 |
+
title = {IB-Robot: Intelligence Boom Robot},
|
| 313 |
+
url = {https://atomgit.com/openeuler/IB_Robot},
|
| 314 |
+
license = {Apache-2.0}
|
| 315 |
+
}
|
artifacts/ascend_310p/vits_flow_decoder_dynamic_fp16.om
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c8b26160a0bc7e4de987424fab228bcc8dfd3fb053bd910737443999412c40d8
|
| 3 |
+
size 210986822
|
artifacts/ascend_310p/vits_flow_decoder_t639_fp16.om
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b7da515895536b7baf75314b908344164efb916ffc8cc2246c6dac0e4c4cf91b
|
| 3 |
+
size 91708818
|
artifacts/ascend_310p/vits_flow_decoder_t681_fp16.om
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:df192baf48cefb732f52945cd411d3c88bbd310cac784dc51e11a8a7ed0d2b61
|
| 3 |
+
size 91706422
|
artifacts/onnx/vits_duration.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f75fd325801a62976ecea0f52ba03a384197f574fedf0486598e5c0fc840c89c
|
| 3 |
+
size 2644862
|
artifacts/onnx/vits_flow_decoder.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3cb9dfe036b843abce71b867626f23d60745c0f0f35f29787ecec7fbfaf0f7fa
|
| 3 |
+
size 86596889
|
artifacts/onnx/vits_text_encoder_clean.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:15c5fb01538ce38c4748c9bc5892fc0af9bee7c65b228cd116651237a3f72536
|
| 3 |
+
size 55329745
|
assets/adapter.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"checkpoint": "onnx/vits_flow_decoder.onnx",
|
| 3 |
+
"checkpoint_sha256": "3cb9dfe036b843abce71b867626f23d60745c0f0f35f29787ecec7fbfaf0f7fa",
|
| 4 |
+
"hop_length": 256,
|
| 5 |
+
"interface": "tensor_model",
|
| 6 |
+
"logical_model_revision": "paddlespeech-vits-csmsc@onnx-export-v1",
|
| 7 |
+
"model_type": "vits",
|
| 8 |
+
"noise_scale": 0.667,
|
| 9 |
+
"noise_scale_dur": 0.0,
|
| 10 |
+
"operation": "synthesize",
|
| 11 |
+
"phone_id_map": "phone_id_map.txt",
|
| 12 |
+
"postprocessing": "mono-float32-pcm-22050hz-v1",
|
| 13 |
+
"preprocessing": "paddlespeech-zh-frontend-jieba-pypinyin-phoneid-v1",
|
| 14 |
+
"sample_rate": 22050,
|
| 15 |
+
"speaker": "csmsc-single-speaker"
|
| 16 |
+
}
|
assets/default.yaml
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This configuration tested on 4 GPUs (V100) with 32GB GPU
|
| 2 |
+
# memory. It takes around 2 weeks to finish the training
|
| 3 |
+
# but 100k iters model should generate reasonable results.
|
| 4 |
+
###########################################################
|
| 5 |
+
# FEATURE EXTRACTION SETTING #
|
| 6 |
+
###########################################################
|
| 7 |
+
|
| 8 |
+
fs: 22050 # sr
|
| 9 |
+
n_fft: 1024 # FFT size (samples).
|
| 10 |
+
n_shift: 256 # Hop size (samples). 12.5ms
|
| 11 |
+
win_length: null # Window length (samples). 50ms
|
| 12 |
+
# If set to null, it will be the same as fft_size.
|
| 13 |
+
window: "hann" # Window function.
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
##########################################################
|
| 17 |
+
# TTS MODEL SETTING #
|
| 18 |
+
##########################################################
|
| 19 |
+
model:
|
| 20 |
+
# generator related
|
| 21 |
+
generator_type: vits_generator
|
| 22 |
+
generator_params:
|
| 23 |
+
hidden_channels: 192
|
| 24 |
+
spks: -1
|
| 25 |
+
global_channels: -1
|
| 26 |
+
segment_size: 32
|
| 27 |
+
text_encoder_attention_heads: 2
|
| 28 |
+
text_encoder_ffn_expand: 4
|
| 29 |
+
text_encoder_blocks: 6
|
| 30 |
+
text_encoder_positionwise_layer_type: "conv1d"
|
| 31 |
+
text_encoder_positionwise_conv_kernel_size: 3
|
| 32 |
+
text_encoder_positional_encoding_layer_type: "rel_pos"
|
| 33 |
+
text_encoder_self_attention_layer_type: "rel_selfattn"
|
| 34 |
+
text_encoder_activation_type: "swish"
|
| 35 |
+
text_encoder_normalize_before: True
|
| 36 |
+
text_encoder_dropout_rate: 0.1
|
| 37 |
+
text_encoder_positional_dropout_rate: 0.0
|
| 38 |
+
text_encoder_attention_dropout_rate: 0.1
|
| 39 |
+
use_macaron_style_in_text_encoder: True
|
| 40 |
+
use_conformer_conv_in_text_encoder: False
|
| 41 |
+
text_encoder_conformer_kernel_size: -1
|
| 42 |
+
decoder_kernel_size: 7
|
| 43 |
+
decoder_channels: 512
|
| 44 |
+
decoder_upsample_scales: [8, 8, 2, 2]
|
| 45 |
+
decoder_upsample_kernel_sizes: [16, 16, 4, 4]
|
| 46 |
+
decoder_resblock_kernel_sizes: [3, 7, 11]
|
| 47 |
+
decoder_resblock_dilations: [[1, 3, 5], [1, 3, 5], [1, 3, 5]]
|
| 48 |
+
use_weight_norm_in_decoder: True
|
| 49 |
+
posterior_encoder_kernel_size: 5
|
| 50 |
+
posterior_encoder_layers: 16
|
| 51 |
+
posterior_encoder_stacks: 1
|
| 52 |
+
posterior_encoder_base_dilation: 1
|
| 53 |
+
posterior_encoder_dropout_rate: 0.0
|
| 54 |
+
use_weight_norm_in_posterior_encoder: True
|
| 55 |
+
flow_flows: 4
|
| 56 |
+
flow_kernel_size: 5
|
| 57 |
+
flow_base_dilation: 1
|
| 58 |
+
flow_layers: 4
|
| 59 |
+
flow_dropout_rate: 0.0
|
| 60 |
+
use_weight_norm_in_flow: True
|
| 61 |
+
use_only_mean_in_flow: True
|
| 62 |
+
stochastic_duration_predictor_kernel_size: 3
|
| 63 |
+
stochastic_duration_predictor_dropout_rate: 0.5
|
| 64 |
+
stochastic_duration_predictor_flows: 4
|
| 65 |
+
stochastic_duration_predictor_dds_conv_layers: 3
|
| 66 |
+
# discriminator related
|
| 67 |
+
discriminator_type: hifigan_multi_scale_multi_period_discriminator
|
| 68 |
+
discriminator_params:
|
| 69 |
+
scales: 1
|
| 70 |
+
scale_downsample_pooling: "AvgPool1D"
|
| 71 |
+
scale_downsample_pooling_params:
|
| 72 |
+
kernel_size: 4
|
| 73 |
+
stride: 2
|
| 74 |
+
padding: 2
|
| 75 |
+
scale_discriminator_params:
|
| 76 |
+
in_channels: 1
|
| 77 |
+
out_channels: 1
|
| 78 |
+
kernel_sizes: [15, 41, 5, 3]
|
| 79 |
+
channels: 128
|
| 80 |
+
max_downsample_channels: 1024
|
| 81 |
+
max_groups: 16
|
| 82 |
+
bias: True
|
| 83 |
+
downsample_scales: [2, 2, 4, 4, 1]
|
| 84 |
+
nonlinear_activation: "leakyrelu"
|
| 85 |
+
nonlinear_activation_params:
|
| 86 |
+
negative_slope: 0.1
|
| 87 |
+
use_weight_norm: True
|
| 88 |
+
use_spectral_norm: False
|
| 89 |
+
follow_official_norm: False
|
| 90 |
+
periods: [2, 3, 5, 7, 11]
|
| 91 |
+
period_discriminator_params:
|
| 92 |
+
in_channels: 1
|
| 93 |
+
out_channels: 1
|
| 94 |
+
kernel_sizes: [5, 3]
|
| 95 |
+
channels: 32
|
| 96 |
+
downsample_scales: [3, 3, 3, 3, 1]
|
| 97 |
+
max_downsample_channels: 1024
|
| 98 |
+
bias: True
|
| 99 |
+
nonlinear_activation: "leakyrelu"
|
| 100 |
+
nonlinear_activation_params:
|
| 101 |
+
negative_slope: 0.1
|
| 102 |
+
use_weight_norm: True
|
| 103 |
+
use_spectral_norm: False
|
| 104 |
+
# others
|
| 105 |
+
sampling_rate: 22050 # needed in the inference for saving wav
|
| 106 |
+
cache_generator_outputs: True # whether to cache generator outputs in the training
|
| 107 |
+
|
| 108 |
+
###########################################################
|
| 109 |
+
# LOSS SETTING #
|
| 110 |
+
###########################################################
|
| 111 |
+
# loss function related
|
| 112 |
+
generator_adv_loss_params:
|
| 113 |
+
average_by_discriminators: False # whether to average loss value by #discriminators
|
| 114 |
+
loss_type: mse # loss type, "mse" or "hinge"
|
| 115 |
+
discriminator_adv_loss_params:
|
| 116 |
+
average_by_discriminators: False # whether to average loss value by #discriminators
|
| 117 |
+
loss_type: mse # loss type, "mse" or "hinge"
|
| 118 |
+
feat_match_loss_params:
|
| 119 |
+
average_by_discriminators: False # whether to average loss value by #discriminators
|
| 120 |
+
average_by_layers: False # whether to average loss value by #layers of each discriminator
|
| 121 |
+
include_final_outputs: True # whether to include final outputs for loss calculation
|
| 122 |
+
mel_loss_params:
|
| 123 |
+
fs: 22050 # must be the same as the training data
|
| 124 |
+
fft_size: 1024 # fft points
|
| 125 |
+
hop_size: 256 # hop size
|
| 126 |
+
win_length: null # window length
|
| 127 |
+
window: hann # window type
|
| 128 |
+
num_mels: 80 # number of Mel basis
|
| 129 |
+
fmin: 0 # minimum frequency for Mel basis
|
| 130 |
+
fmax: null # maximum frequency for Mel basis
|
| 131 |
+
log_base: null # null represent natural log
|
| 132 |
+
|
| 133 |
+
###########################################################
|
| 134 |
+
# ADVERSARIAL LOSS SETTING #
|
| 135 |
+
###########################################################
|
| 136 |
+
lambda_adv: 1.0 # loss scaling coefficient for adversarial loss
|
| 137 |
+
lambda_mel: 45.0 # loss scaling coefficient for Mel loss
|
| 138 |
+
lambda_feat_match: 2.0 # loss scaling coefficient for feat match loss
|
| 139 |
+
lambda_dur: 1.0 # loss scaling coefficient for duration loss
|
| 140 |
+
lambda_kl: 1.0 # loss scaling coefficient for KL divergence loss
|
| 141 |
+
# others
|
| 142 |
+
sampling_rate: 22050 # needed in the inference for saving wav
|
| 143 |
+
cache_generator_outputs: True # whether to cache generator outputs in the training
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
###########################################################
|
| 147 |
+
# DATA LOADER SETTING #
|
| 148 |
+
###########################################################
|
| 149 |
+
batch_size: 64 # Batch size.
|
| 150 |
+
num_workers: 4 # Number of workers in DataLoader.
|
| 151 |
+
|
| 152 |
+
##########################################################
|
| 153 |
+
# OPTIMIZER & SCHEDULER SETTING #
|
| 154 |
+
##########################################################
|
| 155 |
+
# optimizer setting for generator
|
| 156 |
+
generator_optimizer_params:
|
| 157 |
+
beta1: 0.8
|
| 158 |
+
beta2: 0.99
|
| 159 |
+
epsilon: 1.0e-9
|
| 160 |
+
weight_decay: 0.0
|
| 161 |
+
generator_scheduler: exponential_decay
|
| 162 |
+
generator_scheduler_params:
|
| 163 |
+
learning_rate: 2.0e-4
|
| 164 |
+
gamma: 0.999875
|
| 165 |
+
|
| 166 |
+
# optimizer setting for discriminator
|
| 167 |
+
discriminator_optimizer_params:
|
| 168 |
+
beta1: 0.8
|
| 169 |
+
beta2: 0.99
|
| 170 |
+
epsilon: 1.0e-9
|
| 171 |
+
weight_decay: 0.0
|
| 172 |
+
discriminator_scheduler: exponential_decay
|
| 173 |
+
discriminator_scheduler_params:
|
| 174 |
+
learning_rate: 2.0e-4
|
| 175 |
+
gamma: 0.999875
|
| 176 |
+
generator_first: False # whether to start updating generator first
|
| 177 |
+
|
| 178 |
+
##########################################################
|
| 179 |
+
# OTHER TRAINING SETTING #
|
| 180 |
+
##########################################################
|
| 181 |
+
num_snapshots: 30 # max number of snapshots to keep while training
|
| 182 |
+
train_max_steps: 150000 # Number of training steps. == total_iters / ngpus, total_iters = 1000000
|
| 183 |
+
save_interval_steps: 1000 # Interval steps to save checkpoint.
|
| 184 |
+
eval_interval_steps: 250 # Interval steps to evaluate the network.
|
| 185 |
+
seed: 777 # random seed number
|
assets/phone_id_map.txt
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
| 46 |
+
e5 45
|
| 47 |
+
ei1 46
|
| 48 |
+
ei2 47
|
| 49 |
+
ei3 48
|
| 50 |
+
ei4 49
|
| 51 |
+
ei5 50
|
| 52 |
+
en1 51
|
| 53 |
+
en2 52
|
| 54 |
+
en3 53
|
| 55 |
+
en4 54
|
| 56 |
+
en5 55
|
| 57 |
+
eng1 56
|
| 58 |
+
eng2 57
|
| 59 |
+
eng3 58
|
| 60 |
+
eng4 59
|
| 61 |
+
eng5 60
|
| 62 |
+
enr1 61
|
| 63 |
+
enr2 62
|
| 64 |
+
enr4 63
|
| 65 |
+
enr5 64
|
| 66 |
+
er2 65
|
| 67 |
+
er3 66
|
| 68 |
+
er4 67
|
| 69 |
+
er5 68
|
| 70 |
+
f 69
|
| 71 |
+
g 70
|
| 72 |
+
h 71
|
| 73 |
+
i1 72
|
| 74 |
+
i2 73
|
| 75 |
+
i3 74
|
| 76 |
+
i4 75
|
| 77 |
+
i5 76
|
| 78 |
+
ia1 77
|
| 79 |
+
ia2 78
|
| 80 |
+
ia3 79
|
| 81 |
+
ia4 80
|
| 82 |
+
ia5 81
|
| 83 |
+
ian1 82
|
| 84 |
+
ian2 83
|
| 85 |
+
ian3 84
|
| 86 |
+
ian4 85
|
| 87 |
+
ian5 86
|
| 88 |
+
iang1 87
|
| 89 |
+
iang2 88
|
| 90 |
+
iang3 89
|
| 91 |
+
iang4 90
|
| 92 |
+
iang5 91
|
| 93 |
+
iangr4 92
|
| 94 |
+
ianr1 93
|
| 95 |
+
ianr2 94
|
| 96 |
+
ianr3 95
|
| 97 |
+
iao1 96
|
| 98 |
+
iao2 97
|
| 99 |
+
iao3 98
|
| 100 |
+
iao4 99
|
| 101 |
+
iao5 100
|
| 102 |
+
iar1 101
|
| 103 |
+
iar3 102
|
| 104 |
+
ie1 103
|
| 105 |
+
ie2 104
|
| 106 |
+
ie3 105
|
| 107 |
+
ie4 106
|
| 108 |
+
ie5 107
|
| 109 |
+
ii1 108
|
| 110 |
+
ii2 109
|
| 111 |
+
ii3 110
|
| 112 |
+
ii4 111
|
| 113 |
+
ii5 112
|
| 114 |
+
iii1 113
|
| 115 |
+
iii2 114
|
| 116 |
+
iii3 115
|
| 117 |
+
iii4 116
|
| 118 |
+
iii5 117
|
| 119 |
+
iiir4 118
|
| 120 |
+
iir2 119
|
| 121 |
+
in1 120
|
| 122 |
+
in2 121
|
| 123 |
+
in3 122
|
| 124 |
+
in4 123
|
| 125 |
+
in5 124
|
| 126 |
+
ing1 125
|
| 127 |
+
ing2 126
|
| 128 |
+
ing3 127
|
| 129 |
+
ing4 128
|
| 130 |
+
ing5 129
|
| 131 |
+
ingr2 130
|
| 132 |
+
ingr3 131
|
| 133 |
+
inr4 132
|
| 134 |
+
io1 133
|
| 135 |
+
io5 134
|
| 136 |
+
iong1 135
|
| 137 |
+
iong2 136
|
| 138 |
+
iong3 137
|
| 139 |
+
iong4 138
|
| 140 |
+
iong5 139
|
| 141 |
+
iou1 140
|
| 142 |
+
iou2 141
|
| 143 |
+
iou3 142
|
| 144 |
+
iou4 143
|
| 145 |
+
iou5 144
|
| 146 |
+
iour1 145
|
| 147 |
+
ir1 146
|
| 148 |
+
ir2 147
|
| 149 |
+
ir3 148
|
| 150 |
+
ir4 149
|
| 151 |
+
ir5 150
|
| 152 |
+
j 151
|
| 153 |
+
k 152
|
| 154 |
+
l 153
|
| 155 |
+
m 154
|
| 156 |
+
n 155
|
| 157 |
+
o1 156
|
| 158 |
+
o2 157
|
| 159 |
+
o3 158
|
| 160 |
+
o4 159
|
| 161 |
+
o5 160
|
| 162 |
+
ong1 161
|
| 163 |
+
ong2 162
|
| 164 |
+
ong3 163
|
| 165 |
+
ong4 164
|
| 166 |
+
ong5 165
|
| 167 |
+
ongr4 166
|
| 168 |
+
ou1 167
|
| 169 |
+
ou2 168
|
| 170 |
+
ou3 169
|
| 171 |
+
ou4 170
|
| 172 |
+
ou5 171
|
| 173 |
+
our2 172
|
| 174 |
+
p 173
|
| 175 |
+
q 174
|
| 176 |
+
r 175
|
| 177 |
+
s 176
|
| 178 |
+
sh 177
|
| 179 |
+
sil 178
|
| 180 |
+
sp 179
|
| 181 |
+
spl 180
|
| 182 |
+
spn 181
|
| 183 |
+
t 182
|
| 184 |
+
u1 183
|
| 185 |
+
u2 184
|
| 186 |
+
u3 185
|
| 187 |
+
u4 186
|
| 188 |
+
u5 187
|
| 189 |
+
ua1 188
|
| 190 |
+
ua2 189
|
| 191 |
+
ua3 190
|
| 192 |
+
ua4 191
|
| 193 |
+
ua5 192
|
| 194 |
+
uai1 193
|
| 195 |
+
uai2 194
|
| 196 |
+
uai3 195
|
| 197 |
+
uai4 196
|
| 198 |
+
uai5 197
|
| 199 |
+
uair4 198
|
| 200 |
+
uan1 199
|
| 201 |
+
uan2 200
|
| 202 |
+
uan3 201
|
| 203 |
+
uan4 202
|
| 204 |
+
uan5 203
|
| 205 |
+
uang1 204
|
| 206 |
+
uang2 205
|
| 207 |
+
uang3 206
|
| 208 |
+
uang4 207
|
| 209 |
+
uang5 208
|
| 210 |
+
uanr1 209
|
| 211 |
+
uanr2 210
|
| 212 |
+
uei1 211
|
| 213 |
+
uei2 212
|
| 214 |
+
uei3 213
|
| 215 |
+
uei4 214
|
| 216 |
+
uei5 215
|
| 217 |
+
ueir1 216
|
| 218 |
+
ueir3 217
|
| 219 |
+
ueir4 218
|
| 220 |
+
uen1 219
|
| 221 |
+
uen2 220
|
| 222 |
+
uen3 221
|
| 223 |
+
uen4 222
|
| 224 |
+
uen5 223
|
| 225 |
+
ueng1 224
|
| 226 |
+
ueng2 225
|
| 227 |
+
ueng3 226
|
| 228 |
+
ueng4 227
|
| 229 |
+
uenr3 228
|
| 230 |
+
uenr4 229
|
| 231 |
+
uo1 230
|
| 232 |
+
uo2 231
|
| 233 |
+
uo3 232
|
| 234 |
+
uo4 233
|
| 235 |
+
uo5 234
|
| 236 |
+
uor2 235
|
| 237 |
+
uor3 236
|
| 238 |
+
ur3 237
|
| 239 |
+
ur4 238
|
| 240 |
+
v1 239
|
| 241 |
+
v2 240
|
| 242 |
+
v3 241
|
| 243 |
+
v4 242
|
| 244 |
+
v5 243
|
| 245 |
+
van1 244
|
| 246 |
+
van2 245
|
| 247 |
+
van3 246
|
| 248 |
+
van4 247
|
| 249 |
+
van5 248
|
| 250 |
+
vanr4 249
|
| 251 |
+
ve1 250
|
| 252 |
+
ve2 251
|
| 253 |
+
ve3 252
|
| 254 |
+
ve4 253
|
| 255 |
+
ve5 254
|
| 256 |
+
vn1 255
|
| 257 |
+
vn2 256
|
| 258 |
+
vn3 257
|
| 259 |
+
vn4 258
|
| 260 |
+
vn5 259
|
| 261 |
+
x 260
|
| 262 |
+
z 261
|
| 263 |
+
zh 262
|
| 264 |
+
, 263
|
| 265 |
+
。 264
|
| 266 |
+
? 265
|
| 267 |
+
! 266
|
| 268 |
+
<eos> 267
|
assets/reference_impl/run_vits_hybrid_310p.py
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
import json
|
| 3 |
+
import time
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
import numpy as np
|
| 7 |
+
import onnxruntime as ort
|
| 8 |
+
import soundfile as sf
|
| 9 |
+
from ais_bench.infer.interface import InferSession
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
ROOT = Path("/root/workspace/VITS")
|
| 13 |
+
ENCODER = ROOT / "output/onnx/vits_text_encoder_clean.onnx"
|
| 14 |
+
DURATION = ROOT / "output/onnx/vits_duration.onnx"
|
| 15 |
+
FLOW_OM = ROOT / "output/om/vits_flow_decoder_t639_fp16.om"
|
| 16 |
+
GOLDEN = ROOT / "golden/hybrid_chain_golden.npz"
|
| 17 |
+
WAV = ROOT / "output/audio/vits_hybrid_310p_noise_dur0_seed1234.wav"
|
| 18 |
+
REPORT = ROOT / "manifest/vits_hybrid_310p_report.json"
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def generate_path(durations):
|
| 22 |
+
durations = np.asarray(durations, dtype=np.int64)
|
| 23 |
+
total = int(durations.sum())
|
| 24 |
+
path = np.zeros((1, 1, total, durations.shape[-1]), dtype=np.float32)
|
| 25 |
+
offset = 0
|
| 26 |
+
for index, count in enumerate(durations.reshape(-1)):
|
| 27 |
+
next_offset = offset + int(count)
|
| 28 |
+
path[0, 0, offset:next_offset, index] = 1.0
|
| 29 |
+
offset = next_offset
|
| 30 |
+
return path
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def percentile(values, q):
|
| 34 |
+
return float(np.percentile(np.asarray(values, dtype=np.float64), q))
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
golden = np.load(GOLDEN)
|
| 38 |
+
phone_ids = np.ascontiguousarray(golden["phone_ids"].astype(np.int64))
|
| 39 |
+
text_lengths = np.ascontiguousarray(golden["text_lengths"].astype(np.int64))
|
| 40 |
+
load_started = time.perf_counter()
|
| 41 |
+
encoder = ort.InferenceSession(str(ENCODER), providers=["CPUExecutionProvider"])
|
| 42 |
+
duration = ort.InferenceSession(str(DURATION), providers=["CPUExecutionProvider"])
|
| 43 |
+
flow = InferSession(0, str(FLOW_OM))
|
| 44 |
+
load_seconds = time.perf_counter() - load_started
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def infer_once():
|
| 48 |
+
stage = {}
|
| 49 |
+
started = time.perf_counter()
|
| 50 |
+
x, m_p, logs_p, x_mask = encoder.run(
|
| 51 |
+
None, {"text": phone_ids, "text_lengths": text_lengths}
|
| 52 |
+
)
|
| 53 |
+
stage["encoder"] = time.perf_counter() - started
|
| 54 |
+
started = time.perf_counter()
|
| 55 |
+
logw = duration.run(
|
| 56 |
+
None, {"x": x.astype(np.float32), "x_mask": x_mask.astype(bool)}
|
| 57 |
+
)[0]
|
| 58 |
+
stage["duration"] = time.perf_counter() - started
|
| 59 |
+
started = time.perf_counter()
|
| 60 |
+
dur = np.ceil(np.exp(logw) * x_mask.astype(np.float32)).astype(np.int64)
|
| 61 |
+
path = generate_path(dur)
|
| 62 |
+
m_expanded = np.matmul(path[:, 0], np.transpose(m_p, (0, 2, 1)))
|
| 63 |
+
m_expanded = np.transpose(m_expanded, (0, 2, 1)).astype(np.float32)
|
| 64 |
+
logs_expanded = np.matmul(path[:, 0], np.transpose(logs_p, (0, 2, 1)))
|
| 65 |
+
logs_expanded = np.transpose(logs_expanded, (0, 2, 1)).astype(np.float32)
|
| 66 |
+
y_mask = np.ones((1, 1, m_expanded.shape[-1]), dtype=np.float32)
|
| 67 |
+
noise = np.random.RandomState(1234).standard_normal(m_expanded.shape).astype(np.float32)
|
| 68 |
+
z_p = np.ascontiguousarray(
|
| 69 |
+
m_expanded + noise * np.exp(logs_expanded) * np.float32(0.667)
|
| 70 |
+
)
|
| 71 |
+
stage["host"] = time.perf_counter() - started
|
| 72 |
+
if z_p.shape[-1] != 639:
|
| 73 |
+
raise RuntimeError(f"Expected 639 frames for this fixed OM, got {z_p.shape[-1]}")
|
| 74 |
+
started = time.perf_counter()
|
| 75 |
+
wav = flow.infer([z_p, y_mask], out_array=True)[0]
|
| 76 |
+
stage["flow_om"] = time.perf_counter() - started
|
| 77 |
+
return np.asarray(wav, dtype=np.float32).reshape(-1), stage
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
for _ in range(3):
|
| 81 |
+
infer_once()
|
| 82 |
+
elapsed = []
|
| 83 |
+
stages = {"encoder": [], "duration": [], "host": [], "flow_om": []}
|
| 84 |
+
wav = None
|
| 85 |
+
for _ in range(20):
|
| 86 |
+
started = time.perf_counter()
|
| 87 |
+
wav, stage = infer_once()
|
| 88 |
+
elapsed.append(time.perf_counter() - started)
|
| 89 |
+
for name, value in stage.items():
|
| 90 |
+
stages[name].append(value)
|
| 91 |
+
|
| 92 |
+
sf.write(WAV, wav, 22050)
|
| 93 |
+
audio_seconds = wav.size / 22050.0
|
| 94 |
+
reference = golden["wav"].reshape(-1).astype(np.float64)
|
| 95 |
+
candidate = wav.astype(np.float64)
|
| 96 |
+
diff = np.abs(reference - candidate)
|
| 97 |
+
report = {
|
| 98 |
+
"python": "/root/IB_Robot/venv/bin/python3",
|
| 99 |
+
"models": {
|
| 100 |
+
"text_encoder": str(ENCODER),
|
| 101 |
+
"duration": str(DURATION),
|
| 102 |
+
"flow_om": str(FLOW_OM),
|
| 103 |
+
},
|
| 104 |
+
"load_seconds": load_seconds,
|
| 105 |
+
"runs": len(elapsed),
|
| 106 |
+
"audio_seconds": audio_seconds,
|
| 107 |
+
"duration_frames": int(wav.size // 256),
|
| 108 |
+
"latency_ms_mean": float(np.mean(elapsed) * 1000),
|
| 109 |
+
"latency_ms_p50": percentile(elapsed, 50) * 1000,
|
| 110 |
+
"latency_ms_p95": percentile(elapsed, 95) * 1000,
|
| 111 |
+
"rtf_mean": float(np.mean(elapsed) / audio_seconds),
|
| 112 |
+
"stages_ms_mean": {
|
| 113 |
+
name: float(np.mean(values) * 1000) for name, values in stages.items()
|
| 114 |
+
},
|
| 115 |
+
"finite": bool(np.isfinite(wav).all()),
|
| 116 |
+
"cosine_vs_onnx": float(
|
| 117 |
+
np.dot(reference, candidate)
|
| 118 |
+
/ (np.linalg.norm(reference) * np.linalg.norm(candidate))
|
| 119 |
+
),
|
| 120 |
+
"max_abs_vs_onnx": float(diff.max()),
|
| 121 |
+
"mean_abs_vs_onnx": float(diff.mean()),
|
| 122 |
+
"rms": float(np.sqrt(np.mean(candidate * candidate))),
|
| 123 |
+
"wav": str(WAV),
|
| 124 |
+
}
|
| 125 |
+
REPORT.write_text(json.dumps(report, indent=2), encoding="utf-8")
|
| 126 |
+
print(json.dumps(report, indent=2))
|
assets/reference_impl/synthesize_vits_310p.py
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
import argparse
|
| 3 |
+
import json
|
| 4 |
+
import os
|
| 5 |
+
import sys
|
| 6 |
+
import time
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
|
| 9 |
+
ROOT = Path("/root/workspace/VITS")
|
| 10 |
+
os.environ.setdefault("TMPDIR", str(ROOT / "tmp"))
|
| 11 |
+
sys.path.insert(0, str(ROOT / "vendor"))
|
| 12 |
+
|
| 13 |
+
import numpy as np
|
| 14 |
+
import onnxruntime as ort
|
| 15 |
+
import soundfile as sf
|
| 16 |
+
from ais_bench.infer.interface import InferSession
|
| 17 |
+
from paddlespeech.t2s.frontend.zh_frontend import Frontend
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def generate_path(durations):
|
| 21 |
+
durations = np.asarray(durations, dtype=np.int64)
|
| 22 |
+
total = int(durations.sum())
|
| 23 |
+
path = np.zeros((1, 1, total, durations.shape[-1]), dtype=np.float32)
|
| 24 |
+
offset = 0
|
| 25 |
+
for index, count in enumerate(durations.reshape(-1)):
|
| 26 |
+
next_offset = offset + int(count)
|
| 27 |
+
path[0, 0, offset:next_offset, index] = 1.0
|
| 28 |
+
offset = next_offset
|
| 29 |
+
return path
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def main():
|
| 33 |
+
parser = argparse.ArgumentParser(description="PaddleSpeech VITS-CSMSC hybrid inference on Ascend 310P")
|
| 34 |
+
parser.add_argument("--text", required=True)
|
| 35 |
+
parser.add_argument("--output", default=str(ROOT / "output/audio/vits_310p.wav"))
|
| 36 |
+
parser.add_argument("--seed", type=int, default=1234)
|
| 37 |
+
parser.add_argument("--runs", type=int, default=5)
|
| 38 |
+
args = parser.parse_args()
|
| 39 |
+
encoder_path = ROOT / "output/onnx/vits_text_encoder_clean.onnx"
|
| 40 |
+
duration_path = ROOT / "output/onnx/vits_duration.onnx"
|
| 41 |
+
dynamic_om = ROOT / "output/om/vits_flow_decoder_dynamic_fp16_linux_aarch64.om"
|
| 42 |
+
fixed_om = ROOT / "output/om/vits_flow_decoder_t639_fp16.om"
|
| 43 |
+
om_path = dynamic_om if dynamic_om.exists() else fixed_om
|
| 44 |
+
|
| 45 |
+
frontend_started = time.perf_counter()
|
| 46 |
+
frontend = Frontend(
|
| 47 |
+
g2p_model="pypinyin",
|
| 48 |
+
phone_vocab_path=str(ROOT / "models/phone_id_map.txt"),
|
| 49 |
+
)
|
| 50 |
+
phone_ids = frontend.get_input_ids(
|
| 51 |
+
args.text, merge_sentences=True, add_blank=True
|
| 52 |
+
)["phone_ids"][0].astype(np.int64)[None]
|
| 53 |
+
frontend_seconds = time.perf_counter() - frontend_started
|
| 54 |
+
text_lengths = np.array([phone_ids.shape[1]], dtype=np.int64)
|
| 55 |
+
|
| 56 |
+
load_started = time.perf_counter()
|
| 57 |
+
encoder = ort.InferenceSession(str(encoder_path), providers=["CPUExecutionProvider"])
|
| 58 |
+
duration = ort.InferenceSession(str(duration_path), providers=["CPUExecutionProvider"])
|
| 59 |
+
flow = InferSession(0, str(om_path))
|
| 60 |
+
load_seconds = time.perf_counter() - load_started
|
| 61 |
+
|
| 62 |
+
def infer_once():
|
| 63 |
+
stage = {}
|
| 64 |
+
started = time.perf_counter()
|
| 65 |
+
x, m_p, logs_p, x_mask = encoder.run(
|
| 66 |
+
None, {"text": phone_ids, "text_lengths": text_lengths}
|
| 67 |
+
)
|
| 68 |
+
stage["text_encoder"] = time.perf_counter() - started
|
| 69 |
+
started = time.perf_counter()
|
| 70 |
+
logw = duration.run(
|
| 71 |
+
None, {"x": x.astype(np.float32), "x_mask": x_mask.astype(bool)}
|
| 72 |
+
)[0]
|
| 73 |
+
stage["duration"] = time.perf_counter() - started
|
| 74 |
+
started = time.perf_counter()
|
| 75 |
+
dur = np.ceil(np.exp(logw) * x_mask.astype(np.float32)).astype(np.int64)
|
| 76 |
+
path = generate_path(dur)
|
| 77 |
+
m_expanded = np.matmul(path[:, 0], np.transpose(m_p, (0, 2, 1)))
|
| 78 |
+
m_expanded = np.transpose(m_expanded, (0, 2, 1)).astype(np.float32)
|
| 79 |
+
logs_expanded = np.matmul(path[:, 0], np.transpose(logs_p, (0, 2, 1)))
|
| 80 |
+
logs_expanded = np.transpose(logs_expanded, (0, 2, 1)).astype(np.float32)
|
| 81 |
+
y_mask = np.ones((1, 1, m_expanded.shape[-1]), dtype=np.float32)
|
| 82 |
+
noise = np.random.RandomState(args.seed).standard_normal(m_expanded.shape).astype(np.float32)
|
| 83 |
+
z_p = np.ascontiguousarray(
|
| 84 |
+
m_expanded + noise * np.exp(logs_expanded) * np.float32(0.667)
|
| 85 |
+
)
|
| 86 |
+
y_mask = np.ascontiguousarray(y_mask)
|
| 87 |
+
stage["host"] = time.perf_counter() - started
|
| 88 |
+
if om_path == fixed_om and z_p.shape[-1] != 639:
|
| 89 |
+
raise RuntimeError(
|
| 90 |
+
f"Dynamic OM is not ready; fixed OM accepts 639 frames, this text produced {z_p.shape[-1]}"
|
| 91 |
+
)
|
| 92 |
+
started = time.perf_counter()
|
| 93 |
+
if om_path == dynamic_om:
|
| 94 |
+
wav = flow.infer(
|
| 95 |
+
[z_p, y_mask], mode="dymshape", custom_sizes=20_000_000, out_array=True
|
| 96 |
+
)[0]
|
| 97 |
+
else:
|
| 98 |
+
wav = flow.infer([z_p, y_mask], out_array=True)[0]
|
| 99 |
+
stage["flow_om"] = time.perf_counter() - started
|
| 100 |
+
return np.asarray(wav, dtype=np.float32).reshape(-1), int(dur.sum()), stage
|
| 101 |
+
|
| 102 |
+
for _ in range(2):
|
| 103 |
+
infer_once()
|
| 104 |
+
totals = []
|
| 105 |
+
stages = {"text_encoder": [], "duration": [], "host": [], "flow_om": []}
|
| 106 |
+
wav = None
|
| 107 |
+
frames = None
|
| 108 |
+
for _ in range(args.runs):
|
| 109 |
+
started = time.perf_counter()
|
| 110 |
+
wav, frames, stage = infer_once()
|
| 111 |
+
totals.append(time.perf_counter() - started)
|
| 112 |
+
for name, value in stage.items():
|
| 113 |
+
stages[name].append(value)
|
| 114 |
+
|
| 115 |
+
output = Path(args.output)
|
| 116 |
+
if not output.is_absolute():
|
| 117 |
+
output = ROOT / "output/audio" / output
|
| 118 |
+
output = output.resolve()
|
| 119 |
+
allowed = (ROOT / "output/audio").resolve()
|
| 120 |
+
if output != allowed and allowed not in output.parents:
|
| 121 |
+
raise ValueError(f"Output must stay under {allowed}")
|
| 122 |
+
output.parent.mkdir(parents=True, exist_ok=True)
|
| 123 |
+
sf.write(output, wav, 22050)
|
| 124 |
+
audio_seconds = wav.size / 22050.0
|
| 125 |
+
report = {
|
| 126 |
+
"text": args.text,
|
| 127 |
+
"phone_count": int(phone_ids.shape[1]),
|
| 128 |
+
"duration_frames": frames,
|
| 129 |
+
"sample_rate": 22050,
|
| 130 |
+
"audio_seconds": audio_seconds,
|
| 131 |
+
"frontend_seconds": frontend_seconds,
|
| 132 |
+
"load_seconds": load_seconds,
|
| 133 |
+
"warm_runs": args.runs,
|
| 134 |
+
"latency_ms_mean": float(np.mean(totals) * 1000),
|
| 135 |
+
"latency_ms_p50": float(np.percentile(totals, 50) * 1000),
|
| 136 |
+
"latency_ms_p95": float(np.percentile(totals, 95) * 1000),
|
| 137 |
+
"rtf_mean": float(np.mean(totals) / audio_seconds),
|
| 138 |
+
"stages_ms_mean": {
|
| 139 |
+
name: float(np.mean(values) * 1000) for name, values in stages.items()
|
| 140 |
+
},
|
| 141 |
+
"finite": bool(np.isfinite(wav).all()),
|
| 142 |
+
"rms": float(np.sqrt(np.mean(wav.astype(np.float64) ** 2))),
|
| 143 |
+
"min": float(wav.min()),
|
| 144 |
+
"max": float(wav.max()),
|
| 145 |
+
"om": str(om_path),
|
| 146 |
+
"output": str(output),
|
| 147 |
+
}
|
| 148 |
+
report_path = ROOT / "manifest" / f"{output.stem}_report.json"
|
| 149 |
+
report_path.write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding="utf-8")
|
| 150 |
+
print(json.dumps(report, ensure_ascii=False, indent=2))
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
if __name__ == "__main__":
|
| 154 |
+
main()
|
assets/snapshot_iter_150000.pdz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ef0faad8186cdd1aa278b61e0b2a3cb7dee9216d1b84f1bc760ec887bcd935c7
|
| 3 |
+
size 1116898380
|
inference_manifest.json
ADDED
|
@@ -0,0 +1,508 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bundle": {
|
| 3 |
+
"digest": {
|
| 4 |
+
"algorithm": "sha256",
|
| 5 |
+
"scope": "structure",
|
| 6 |
+
"value": "0d44f6715fb1c717c40707cf727096a7bb41642044ce232edea2200b92c46773"
|
| 7 |
+
},
|
| 8 |
+
"files": [
|
| 9 |
+
{
|
| 10 |
+
"path": "assets/adapter.json"
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"path": "assets/phone_id_map.txt"
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"path": "assets/snapshot_iter_150000.pdz"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"path": "assets/default.yaml"
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"path": "artifacts/ascend_310p/vits_flow_decoder_t639_fp16.om"
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"path": "artifacts/ascend_310p/vits_flow_decoder_t681_fp16.om"
|
| 26 |
+
}
|
| 27 |
+
],
|
| 28 |
+
"name": "vits-csmsc",
|
| 29 |
+
"revision": 1,
|
| 30 |
+
"uuid": "ddac9629-06a2-5bc4-87ce-6ae97c4ebd24"
|
| 31 |
+
},
|
| 32 |
+
"deployments": {
|
| 33 |
+
"ascend_310p": {
|
| 34 |
+
"artifacts": {
|
| 35 |
+
"duration": {
|
| 36 |
+
"format": "onnx",
|
| 37 |
+
"path": "artifacts/onnx/vits_duration.onnx",
|
| 38 |
+
"sha256": "f75fd325801a62976ecea0f52ba03a384197f574fedf0486598e5c0fc840c89c"
|
| 39 |
+
},
|
| 40 |
+
"flow_decoder": {
|
| 41 |
+
"format": "om",
|
| 42 |
+
"path": "artifacts/ascend_310p/vits_flow_decoder_dynamic_fp16.om",
|
| 43 |
+
"sha256": "c8b26160a0bc7e4de987424fab228bcc8dfd3fb053bd910737443999412c40d8"
|
| 44 |
+
},
|
| 45 |
+
"text_encoder": {
|
| 46 |
+
"format": "onnx",
|
| 47 |
+
"path": "artifacts/onnx/vits_text_encoder_clean.onnx",
|
| 48 |
+
"sha256": "15c5fb01538ce38c4748c9bc5892fc0af9bee7c65b228cd116651237a3f72536"
|
| 49 |
+
}
|
| 50 |
+
},
|
| 51 |
+
"bindings": {
|
| 52 |
+
"duration": {
|
| 53 |
+
"inputs": [
|
| 54 |
+
{
|
| 55 |
+
"dtype": "float32",
|
| 56 |
+
"index": 0,
|
| 57 |
+
"runtime_name": "x",
|
| 58 |
+
"semantic": "host.vits.x",
|
| 59 |
+
"shape": [
|
| 60 |
+
1,
|
| 61 |
+
192,
|
| 62 |
+
-1
|
| 63 |
+
]
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"dtype": "bool",
|
| 67 |
+
"index": 1,
|
| 68 |
+
"runtime_name": "x_mask",
|
| 69 |
+
"semantic": "host.vits.x_mask",
|
| 70 |
+
"shape": [
|
| 71 |
+
1,
|
| 72 |
+
1,
|
| 73 |
+
-1
|
| 74 |
+
]
|
| 75 |
+
}
|
| 76 |
+
],
|
| 77 |
+
"outputs": [
|
| 78 |
+
{
|
| 79 |
+
"dtype": "float32",
|
| 80 |
+
"index": 0,
|
| 81 |
+
"runtime_name": "save_infer_model/scale_0.tmp_0",
|
| 82 |
+
"semantic": "host.vits.logw",
|
| 83 |
+
"shape": [
|
| 84 |
+
1,
|
| 85 |
+
1,
|
| 86 |
+
-1
|
| 87 |
+
]
|
| 88 |
+
}
|
| 89 |
+
]
|
| 90 |
+
},
|
| 91 |
+
"flow_decoder": {
|
| 92 |
+
"inputs": [
|
| 93 |
+
{
|
| 94 |
+
"dtype": "float32",
|
| 95 |
+
"index": 0,
|
| 96 |
+
"runtime_name": "z_p",
|
| 97 |
+
"semantic": "host.vits.z_p",
|
| 98 |
+
"shape": [
|
| 99 |
+
1,
|
| 100 |
+
192,
|
| 101 |
+
-1
|
| 102 |
+
]
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"dtype": "float32",
|
| 106 |
+
"index": 1,
|
| 107 |
+
"runtime_name": "y_mask",
|
| 108 |
+
"semantic": "host.vits.y_mask",
|
| 109 |
+
"shape": [
|
| 110 |
+
1,
|
| 111 |
+
1,
|
| 112 |
+
-1
|
| 113 |
+
]
|
| 114 |
+
}
|
| 115 |
+
],
|
| 116 |
+
"outputs": [
|
| 117 |
+
{
|
| 118 |
+
"dtype": "float32",
|
| 119 |
+
"index": 0,
|
| 120 |
+
"runtime_name": "p2o.Squeeze.118:0:save_infer_model/scale_0.tmp_0",
|
| 121 |
+
"semantic": "tts.audio",
|
| 122 |
+
"shape": [
|
| 123 |
+
1,
|
| 124 |
+
-1
|
| 125 |
+
]
|
| 126 |
+
}
|
| 127 |
+
]
|
| 128 |
+
},
|
| 129 |
+
"text_encoder": {
|
| 130 |
+
"inputs": [
|
| 131 |
+
{
|
| 132 |
+
"dtype": "int64",
|
| 133 |
+
"index": 0,
|
| 134 |
+
"runtime_name": "text",
|
| 135 |
+
"semantic": "host.vits.phone_ids",
|
| 136 |
+
"shape": [
|
| 137 |
+
1,
|
| 138 |
+
-1
|
| 139 |
+
]
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"dtype": "int64",
|
| 143 |
+
"index": 1,
|
| 144 |
+
"runtime_name": "text_lengths",
|
| 145 |
+
"semantic": "host.vits.phone_count",
|
| 146 |
+
"shape": [
|
| 147 |
+
1
|
| 148 |
+
]
|
| 149 |
+
}
|
| 150 |
+
],
|
| 151 |
+
"outputs": [
|
| 152 |
+
{
|
| 153 |
+
"dtype": "float32",
|
| 154 |
+
"index": 0,
|
| 155 |
+
"runtime_name": "save_infer_model/scale_0.tmp_0",
|
| 156 |
+
"semantic": "host.vits.x",
|
| 157 |
+
"shape": [
|
| 158 |
+
1,
|
| 159 |
+
192,
|
| 160 |
+
-1
|
| 161 |
+
]
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"dtype": "float32",
|
| 165 |
+
"index": 1,
|
| 166 |
+
"runtime_name": "save_infer_model/scale_1.tmp_0",
|
| 167 |
+
"semantic": "host.vits.m_p",
|
| 168 |
+
"shape": [
|
| 169 |
+
1,
|
| 170 |
+
192,
|
| 171 |
+
-1
|
| 172 |
+
]
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"dtype": "float32",
|
| 176 |
+
"index": 2,
|
| 177 |
+
"runtime_name": "save_infer_model/scale_2.tmp_0",
|
| 178 |
+
"semantic": "host.vits.logs_p",
|
| 179 |
+
"shape": [
|
| 180 |
+
1,
|
| 181 |
+
192,
|
| 182 |
+
-1
|
| 183 |
+
]
|
| 184 |
+
},
|
| 185 |
+
{
|
| 186 |
+
"dtype": "bool",
|
| 187 |
+
"index": 3,
|
| 188 |
+
"runtime_name": "unsqueeze2_2.tmp_0",
|
| 189 |
+
"semantic": "host.vits.x_mask",
|
| 190 |
+
"shape": [
|
| 191 |
+
1,
|
| 192 |
+
1,
|
| 193 |
+
-1
|
| 194 |
+
]
|
| 195 |
+
}
|
| 196 |
+
]
|
| 197 |
+
}
|
| 198 |
+
},
|
| 199 |
+
"execution": [
|
| 200 |
+
"text_encoder",
|
| 201 |
+
"duration",
|
| 202 |
+
"flow_decoder"
|
| 203 |
+
],
|
| 204 |
+
"execution_contract": {
|
| 205 |
+
"cancellation_granularity": "stage",
|
| 206 |
+
"execution_structure": "direct",
|
| 207 |
+
"state_scope": "request",
|
| 208 |
+
"stateful": false
|
| 209 |
+
},
|
| 210 |
+
"metadata": {
|
| 211 |
+
"audio_contract": {
|
| 212 |
+
"channel_semantics": "mono",
|
| 213 |
+
"channels": 1,
|
| 214 |
+
"execution_mode": "offline",
|
| 215 |
+
"sample_dtype": "float32",
|
| 216 |
+
"sample_rate_hz": 22050
|
| 217 |
+
},
|
| 218 |
+
"host_stages": [
|
| 219 |
+
"duration_expand_path",
|
| 220 |
+
"sample_z_p"
|
| 221 |
+
]
|
| 222 |
+
},
|
| 223 |
+
"revision": 1,
|
| 224 |
+
"role_identities": {
|
| 225 |
+
"duration": {
|
| 226 |
+
"interface": "tensor_model",
|
| 227 |
+
"model_type": "vits_csmsc_duration_predictor",
|
| 228 |
+
"operation": "predict_duration"
|
| 229 |
+
},
|
| 230 |
+
"flow_decoder": {
|
| 231 |
+
"interface": "tensor_model",
|
| 232 |
+
"model_type": "vits_csmsc_flow_decoder",
|
| 233 |
+
"operation": "decode_waveform"
|
| 234 |
+
},
|
| 235 |
+
"text_encoder": {
|
| 236 |
+
"interface": "tensor_model",
|
| 237 |
+
"model_type": "vits_csmsc_text_encoder",
|
| 238 |
+
"operation": "encode_text"
|
| 239 |
+
}
|
| 240 |
+
},
|
| 241 |
+
"role_runtime_profiles": {
|
| 242 |
+
"duration": {
|
| 243 |
+
"backend": "onnx",
|
| 244 |
+
"profile": {
|
| 245 |
+
"device": "cpu"
|
| 246 |
+
},
|
| 247 |
+
"target": {
|
| 248 |
+
"runtime": "onnx"
|
| 249 |
+
}
|
| 250 |
+
},
|
| 251 |
+
"flow_decoder": {
|
| 252 |
+
"backend": "ascend",
|
| 253 |
+
"profile": {
|
| 254 |
+
"device_id": 0
|
| 255 |
+
},
|
| 256 |
+
"target": {
|
| 257 |
+
"runtime": "acl",
|
| 258 |
+
"runtime_abi": "cann-8.1.RC1",
|
| 259 |
+
"soc": "Ascend310P1"
|
| 260 |
+
}
|
| 261 |
+
},
|
| 262 |
+
"text_encoder": {
|
| 263 |
+
"backend": "onnx",
|
| 264 |
+
"profile": {
|
| 265 |
+
"device": "cpu"
|
| 266 |
+
},
|
| 267 |
+
"target": {
|
| 268 |
+
"runtime": "onnx"
|
| 269 |
+
}
|
| 270 |
+
}
|
| 271 |
+
},
|
| 272 |
+
"uuid": "f93e0d28-a973-54bd-a51e-f7ee8a868f2e"
|
| 273 |
+
},
|
| 274 |
+
"torch_cpu": {
|
| 275 |
+
"artifacts": {
|
| 276 |
+
"duration": {
|
| 277 |
+
"format": "onnx",
|
| 278 |
+
"path": "artifacts/onnx/vits_duration.onnx",
|
| 279 |
+
"sha256": "f75fd325801a62976ecea0f52ba03a384197f574fedf0486598e5c0fc840c89c"
|
| 280 |
+
},
|
| 281 |
+
"flow_decoder": {
|
| 282 |
+
"format": "onnx",
|
| 283 |
+
"path": "artifacts/onnx/vits_flow_decoder.onnx",
|
| 284 |
+
"sha256": "3cb9dfe036b843abce71b867626f23d60745c0f0f35f29787ecec7fbfaf0f7fa"
|
| 285 |
+
},
|
| 286 |
+
"text_encoder": {
|
| 287 |
+
"format": "onnx",
|
| 288 |
+
"path": "artifacts/onnx/vits_text_encoder_clean.onnx",
|
| 289 |
+
"sha256": "15c5fb01538ce38c4748c9bc5892fc0af9bee7c65b228cd116651237a3f72536"
|
| 290 |
+
}
|
| 291 |
+
},
|
| 292 |
+
"bindings": {
|
| 293 |
+
"duration": {
|
| 294 |
+
"inputs": [
|
| 295 |
+
{
|
| 296 |
+
"dtype": "float32",
|
| 297 |
+
"index": 0,
|
| 298 |
+
"runtime_name": "x",
|
| 299 |
+
"semantic": "host.vits.x",
|
| 300 |
+
"shape": [
|
| 301 |
+
1,
|
| 302 |
+
192,
|
| 303 |
+
-1
|
| 304 |
+
]
|
| 305 |
+
},
|
| 306 |
+
{
|
| 307 |
+
"dtype": "bool",
|
| 308 |
+
"index": 1,
|
| 309 |
+
"runtime_name": "x_mask",
|
| 310 |
+
"semantic": "host.vits.x_mask",
|
| 311 |
+
"shape": [
|
| 312 |
+
1,
|
| 313 |
+
1,
|
| 314 |
+
-1
|
| 315 |
+
]
|
| 316 |
+
}
|
| 317 |
+
],
|
| 318 |
+
"outputs": [
|
| 319 |
+
{
|
| 320 |
+
"dtype": "float32",
|
| 321 |
+
"index": 0,
|
| 322 |
+
"runtime_name": "save_infer_model/scale_0.tmp_0",
|
| 323 |
+
"semantic": "host.vits.logw",
|
| 324 |
+
"shape": [
|
| 325 |
+
1,
|
| 326 |
+
1,
|
| 327 |
+
-1
|
| 328 |
+
]
|
| 329 |
+
}
|
| 330 |
+
]
|
| 331 |
+
},
|
| 332 |
+
"flow_decoder": {
|
| 333 |
+
"inputs": [
|
| 334 |
+
{
|
| 335 |
+
"dtype": "float32",
|
| 336 |
+
"index": 0,
|
| 337 |
+
"runtime_name": "z_p",
|
| 338 |
+
"semantic": "host.vits.z_p",
|
| 339 |
+
"shape": [
|
| 340 |
+
1,
|
| 341 |
+
192,
|
| 342 |
+
-1
|
| 343 |
+
]
|
| 344 |
+
},
|
| 345 |
+
{
|
| 346 |
+
"dtype": "float32",
|
| 347 |
+
"index": 1,
|
| 348 |
+
"runtime_name": "y_mask",
|
| 349 |
+
"semantic": "host.vits.y_mask",
|
| 350 |
+
"shape": [
|
| 351 |
+
1,
|
| 352 |
+
1,
|
| 353 |
+
-1
|
| 354 |
+
]
|
| 355 |
+
}
|
| 356 |
+
],
|
| 357 |
+
"outputs": [
|
| 358 |
+
{
|
| 359 |
+
"dtype": "float32",
|
| 360 |
+
"index": 0,
|
| 361 |
+
"runtime_name": "p2o.Squeeze.118:0:save_infer_model/scale_0.tmp_0",
|
| 362 |
+
"semantic": "tts.audio",
|
| 363 |
+
"shape": [
|
| 364 |
+
1,
|
| 365 |
+
-1
|
| 366 |
+
]
|
| 367 |
+
}
|
| 368 |
+
]
|
| 369 |
+
},
|
| 370 |
+
"text_encoder": {
|
| 371 |
+
"inputs": [
|
| 372 |
+
{
|
| 373 |
+
"dtype": "int64",
|
| 374 |
+
"index": 0,
|
| 375 |
+
"runtime_name": "text",
|
| 376 |
+
"semantic": "host.vits.phone_ids",
|
| 377 |
+
"shape": [
|
| 378 |
+
1,
|
| 379 |
+
-1
|
| 380 |
+
]
|
| 381 |
+
},
|
| 382 |
+
{
|
| 383 |
+
"dtype": "int64",
|
| 384 |
+
"index": 1,
|
| 385 |
+
"runtime_name": "text_lengths",
|
| 386 |
+
"semantic": "host.vits.phone_count",
|
| 387 |
+
"shape": [
|
| 388 |
+
1
|
| 389 |
+
]
|
| 390 |
+
}
|
| 391 |
+
],
|
| 392 |
+
"outputs": [
|
| 393 |
+
{
|
| 394 |
+
"dtype": "float32",
|
| 395 |
+
"index": 0,
|
| 396 |
+
"runtime_name": "save_infer_model/scale_0.tmp_0",
|
| 397 |
+
"semantic": "host.vits.x",
|
| 398 |
+
"shape": [
|
| 399 |
+
1,
|
| 400 |
+
192,
|
| 401 |
+
-1
|
| 402 |
+
]
|
| 403 |
+
},
|
| 404 |
+
{
|
| 405 |
+
"dtype": "float32",
|
| 406 |
+
"index": 1,
|
| 407 |
+
"runtime_name": "save_infer_model/scale_1.tmp_0",
|
| 408 |
+
"semantic": "host.vits.m_p",
|
| 409 |
+
"shape": [
|
| 410 |
+
1,
|
| 411 |
+
192,
|
| 412 |
+
-1
|
| 413 |
+
]
|
| 414 |
+
},
|
| 415 |
+
{
|
| 416 |
+
"dtype": "float32",
|
| 417 |
+
"index": 2,
|
| 418 |
+
"runtime_name": "save_infer_model/scale_2.tmp_0",
|
| 419 |
+
"semantic": "host.vits.logs_p",
|
| 420 |
+
"shape": [
|
| 421 |
+
1,
|
| 422 |
+
192,
|
| 423 |
+
-1
|
| 424 |
+
]
|
| 425 |
+
},
|
| 426 |
+
{
|
| 427 |
+
"dtype": "bool",
|
| 428 |
+
"index": 3,
|
| 429 |
+
"runtime_name": "unsqueeze2_2.tmp_0",
|
| 430 |
+
"semantic": "host.vits.x_mask",
|
| 431 |
+
"shape": [
|
| 432 |
+
1,
|
| 433 |
+
1,
|
| 434 |
+
-1
|
| 435 |
+
]
|
| 436 |
+
}
|
| 437 |
+
]
|
| 438 |
+
}
|
| 439 |
+
},
|
| 440 |
+
"execution": [
|
| 441 |
+
"text_encoder",
|
| 442 |
+
"duration",
|
| 443 |
+
"flow_decoder"
|
| 444 |
+
],
|
| 445 |
+
"execution_contract": {
|
| 446 |
+
"cancellation_granularity": "stage",
|
| 447 |
+
"execution_structure": "direct",
|
| 448 |
+
"state_scope": "request",
|
| 449 |
+
"stateful": false
|
| 450 |
+
},
|
| 451 |
+
"metadata": {
|
| 452 |
+
"audio_contract": {
|
| 453 |
+
"channel_semantics": "mono",
|
| 454 |
+
"channels": 1,
|
| 455 |
+
"execution_mode": "offline",
|
| 456 |
+
"sample_dtype": "float32",
|
| 457 |
+
"sample_rate_hz": 22050
|
| 458 |
+
},
|
| 459 |
+
"host_stages": [
|
| 460 |
+
"duration_expand_path",
|
| 461 |
+
"sample_z_p"
|
| 462 |
+
]
|
| 463 |
+
},
|
| 464 |
+
"revision": 1,
|
| 465 |
+
"runtime_profile": {
|
| 466 |
+
"backend": "onnx",
|
| 467 |
+
"profile": {
|
| 468 |
+
"device": "cpu"
|
| 469 |
+
},
|
| 470 |
+
"target": {
|
| 471 |
+
"runtime": "onnx"
|
| 472 |
+
}
|
| 473 |
+
},
|
| 474 |
+
"uuid": "aac245e5-989a-599a-8c90-173e9f055cfd"
|
| 475 |
+
}
|
| 476 |
+
},
|
| 477 |
+
"model": {
|
| 478 |
+
"inputs": [
|
| 479 |
+
{
|
| 480 |
+
"dtype": "int64",
|
| 481 |
+
"semantic": "tts.phone_ids",
|
| 482 |
+
"shape": [
|
| 483 |
+
1,
|
| 484 |
+
-1
|
| 485 |
+
]
|
| 486 |
+
}
|
| 487 |
+
],
|
| 488 |
+
"interface": "tensor_model",
|
| 489 |
+
"model_type": "vits",
|
| 490 |
+
"operation": "synthesize",
|
| 491 |
+
"outputs": [
|
| 492 |
+
{
|
| 493 |
+
"dtype": "float32",
|
| 494 |
+
"semantic": "tts.audio",
|
| 495 |
+
"shape": [
|
| 496 |
+
1,
|
| 497 |
+
-1
|
| 498 |
+
]
|
| 499 |
+
}
|
| 500 |
+
],
|
| 501 |
+
"semantic_identity": {
|
| 502 |
+
"logical_model_revision": "paddlespeech-vits-csmsc@onnx-export-v1",
|
| 503 |
+
"output_semantics": "mono-float32-pcm-22050hz-v1",
|
| 504 |
+
"preprocessing_contract": "paddlespeech-zh-frontend-jieba-pypinyin-phoneid-v1"
|
| 505 |
+
}
|
| 506 |
+
},
|
| 507 |
+
"schema_version": 3
|
| 508 |
+
}
|