Files
sherpa-onnx/scripts
Stef cc92083394 Keep the STFT convs of Kokoro in float32 when quantizing to int8 (#4087)
The Kokoro decoder's generator computes the phase of its forward STFT
with atan2(imag, real), which the exported graph implements as an
unguarded imag / real followed by Atan. imag and real are produced by
two Conv nodes. quantize_dynamic also quantized these two convs; at DC
and Nyquist the quantized imag is exactly 0, and with int8 arithmetic
real can become exactly 0 there as well, giving 0 / 0 = NaN.

On macOS arm64 the NaN spreads over the whole output, so short pieces of
text come back as all-NaN audio. On x64 the following
DynamicQuantizeLinear happens to drop the NaN, which hides the problem
but does not remove it.

Pass the two convs as nodes_to_exclude, for v1.0 and v1.1-zh. v0.19
computes the STFT without Conv nodes and is not affected.

The released int8 models kokoro-int8-multi-lang-v1_0 and
kokoro-int8-multi-lang-v1_1 need to be regenerated with this change.

Fixes #4086
2026-10-26 17:14:46 +08:00
..
2026-02-05 13:10:37 +08:00
2024-07-10 17:05:26 +08:00
2026-10-23 20:32:33 +08:00
2025-06-20 11:10:07 +08:00
2026-01-26 10:34:49 +08:00
2026-03-12 11:10:55 +08:00
2024-06-14 16:51:53 +08:00
2026-10-21 09:57:49 +08:00
2025-03-17 09:19:50 +08:00
2024-05-21 20:37:29 +08:00
2026-03-12 11:10:55 +08:00
2022-10-12 21:35:07 +08:00