Repository navigation
Kokoro: chunk Chinese and Japanese text at 100 codepoints by default - #1022
Merged
Merged
Conversation
A 240-codepoint chunk of Chinese or Japanese phonemizes to more than 510 symbols, so long text in those languages failed with 'Kokoro phoneme string exceeds 510 symbols'. Default to 100 codepoints for Chinese and Japanese voices; other languages keep 240 and an explicit text_chunk_size still applies.
Owner
|
@hiroki-abe-58 Thanks for improving CJK chunking and fixing language handling! All three PRs merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Long Chinese or Japanese text fails with Kokoro's default
text_chunk_sizeof 240 codepoints:These languages phonemize to several symbols per character. A Chinese chunk exceeds the 510-symbol input limit from about 150 characters, so a 240-character chunk fails, as does any paragraph long enough to fill one.
This PR makes the default 100 codepoints for Chinese and Japanese voices (language codes
zandj, resolved as the frontend already does). Other languages keep 240, and an explicittext_chunk_sizestill takes precedence. The spec no longer declares a fixed default; its description states the rule. The docs are updated to match.Validation
.\scripts\build_windows.ps1 -Preset windows-cuda-release -Target audiocpp_cli -CudaArchitectures 120a-real.audio-cpp/audio.cpp-gguf@44e93ef:Kokoro-82M-GGUF/kokoro-82m-q8_0.gguffor Chinese;kokoro-82m-multilingual-q8_0.gguffor Japanese, with MeCab from themecab-python31.0.12 wheel viaAUDIOCPP_MECAB_LIBRARY.audiocpp_cli --family kokoro_tts --task tts --backend cuda --model <gguf> --text <text> --voice-id <zf_xiaobei|jf_alpha> --language <zh|ja> --seed 1 --out <wav> --log.zf_xiaobeijf_alphajf_alpha--text-chunk-size 100.--text-chunk-size80, 100, 120 and 140, and fails from 160 on.Phoneme-level segmentation, splitting a chunk by its 510-symbol budget, would remove the limit entirely. This PR only keeps the default from hitting it.
🤖 Generated with Claude Code