Skip to content

Chunk CJK text for MOSS-TTS-Nano at 50 codepoints by default - #1025

Merged
0xShug0 merged 1 commit into
0xShug0:mainfrom
hiroki-abe-58:moss-tts-nano-cjk-chunk-size
Oct 21, 2026
Merged

0xShug0 merged 1 commit into
0xShug0:mainfrom
hiroki-abe-58:moss-tts-nano-cjk-chunk-size

Conversation

@hiroki-abe-58

Copy link
Copy Markdown
Contributor

MOSS-TTS-Nano chunks long text at 256 codepoints. That fits English, but a 256-codepoint chunk of Chinese, Japanese or Korean needs more speech than the 300-frame (24 s) max_tokens limit allows, or the model stops early. The rest of the chunk is dropped without an error.

Upstream voice cloning (_split_text_into_best_sentences) packs sentences into chunks of at most 50 text tokens by default, or 75 from its CLI. Its tokenizer spends 0.7–1.2 tokens on a hanzi, kana or Hangul syllable but about 0.25 on a Latin character, so its chunks are:

text upstream, 50 tokens upstream, 75 tokens
Japanese, 404 chars ≤ 41 codepoints ≤ 66
Korean, 331 chars ≤ 43 ≤ 66
Chinese, 219 chars ≤ 60 ≤ 99
English, 782 chars ≤ 176 ≤ 308

This PR uses 50 codepoints by default when hanzi, kana and Hangul outnumber other letters and digits, the same rule as ming3_tts; other text keeps 256. An explicit text_chunk_size still wins. The spec, CLI help and docs are updated.

Measurements

RTX 5090, Windows 11, CUDA build (120a-real), moss-tts-nano-100m-bf16.gguf. CER is from Whisper large-v3-turbo with sequential long-form decoding, averaged over seeds 1–6.

Voice clone (--task clon), with upstream's preset voices zh_1 (Chinese), jp_2 (Japanese and Korean, since there is no Korean preset) and en_2 (English):

text main this PR audio, main → PR
Chinese, 219 chars 0.508 0.017 15.9–24.0 s → 40.4–48.4 s
Korean, 331 chars 0.427 0.104 9.1–44.4 s → 45.1–49.0 s
Japanese, 404 chars 0.638 0.270 14.8–48.0 s → 59.8–75.9 s
Japanese, 141 chars 0.554 0.275 2.6–24.0 s → 20.3–27.6 s

Text-only (--task tts):

  • Chinese: 0.418 → 0.083.
  • Korean: 0.518 → 0.149.
  • Japanese stays poor at every chunk size (0.70 at both 256 and 50), so this PR doesn't help it.

The --log trace shows the cause on main, with voice clone:

  • The 219-character Chinese text is one chunk. It stops at max_new_frames (300) on 4 of the 6 seeds and ends early, at 199 or 210 frames, on the other 2.
  • The 404-character Japanese text is two chunks. 7 of the 12 stop at 300 frames; the rest end early at 33–265.

Byte checks:

  • Every CJK default output of this PR is identical to main with --text-chunk-size 50 (42 WAVs, clone and text-only).
  • English output is identical to main (4 WAVs).
  • Streaming mode (--mode streaming) also takes the new default.

🤖 Generated with Claude Code

A 256-codepoint chunk of hanzi, kana or Hangul holds several of upstream's 50-75-token voice-clone chunks, so it runs into the 300-frame limit or stops early and the rest of the chunk is dropped without an error. Use 50 codepoints when CJK characters outnumber other letters and digits; other text keeps 256.
@0xShug0
0xShug0 merged commit a94ece1 into 0xShug0:main Oct 21, 2026
7 checks passed
@0xShug0

0xShug0 commented Oct 21, 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