Skip to content

Chunk CJK text for MioTTS at 120 codepoints by default - #1046

Merged
0xShug0 merged 1 commit into
0xShug0:mainfrom
hiroki-abe-58:miotts-cjk-chunk-size
Oct 22, 2026
Merged

0xShug0 merged 1 commit into
0xShug0:mainfrom
hiroki-abe-58:miotts-cjk-chunk-size

Conversation

@hiroki-abe-58

Copy link
Copy Markdown
Contributor

MioTTS generates each chunk within max_tokens, 700 tokens or 28 s, and its default chunk is 180 codepoints. Japanese is spoken at about 5–6 characters a second, so a 180-codepoint chunk of it needs more than 28 s, and the end of the chunk is cut without an error. On a 304-character text the output is exactly 2 × 28 s = 56.0 s on 9 of 12 seeds (53.6–55.6 s on the rest), and a clause at the end of the first chunk (「昼過ぎになると観光客が増え、」) is missing.

The official MioTTS-Inference server doesn't chunk. It accepts up to 300 characters per request with the same max_tokens 700.

This PR uses 120 codepoints by default when hanzi, kana and Hangul outnumber other letters and digits, the same rule as ming3_tts, fireredtts3 and moss_tts_nano.

  • Other text keeps 180. English 180 is about 12 s.
  • An explicit request text_chunk_size or session miotts.text_chunk_size still wins.
  • The session option becomes optional so that the per-request default can depend on the text.
  • The spec, CLI help and docs are updated.

Measurements

RTX 5090, Windows 11, CUDA build (120a-real), miotts-1.7b-q8_0.gguf + miocodec-25hz-44khz-v2-q8_0.gguf, voice clone with a 2.6 s Japanese reference. CER is from Whisper large-v3-turbo with sequential long-form decoding, over seeds 1–12, given as mean / median / max.

text 180 (main) 100 120 (this PR)
Japanese, 404 chars 0.138 / 0.108 / 0.325 0.032 / 0.026 / 0.063 0.045 / 0.026 / 0.121
Japanese, 304 chars 0.194 / 0.202 / 0.366 0.129 / 0.052 / 0.850 0.060 / 0.059 / 0.115

100 has the lowest medians, but on 1 of 12 seeds one chunk of the 304-character text fell into repetition and long silences. 120 had no run above 0.13 in 24, so it is the default here; 130 was similar to 120 over 6 seeds. The 141-character text becomes two chunks and stays at 0.023 / 0.030.

MioTTS output on CUDA is not bit-reproducible run to run: the same request twice, with the same seed and chunks, gives different WAVs. So instead of byte checks, the --log trace confirms the branch's defaults:

  • Japanese uses text_chunk_size 120 with the same chunk counts as --text-chunk-size 120 on main (5 and 4 chunks).
  • English uses 180.

The branch's own CER (0.026 / 0.026 and 0.066 / 0.059 for seeds 1–2) is in line with the table.

🤖 Generated with Claude Code

Each chunk is generated within max_tokens, 700 tokens or 28 s, and Japanese is spoken at about 5-6 characters a second, so a 180-codepoint chunk of it ran past the limit and its end was cut without an error. Use 120 codepoints when hanzi, kana and Hangul outnumber other letters and digits; other text keeps 180, and an explicit request or session chunk size still wins.
@0xShug0
0xShug0 merged commit 76ea191 into 0xShug0:main Oct 22, 2026
7 checks passed
@0xShug0

0xShug0 commented Oct 22, 2026

Copy link
Copy Markdown
Owner

@hiroki-abe-58 Thanks! PR merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants