Chatterbox-TTS-Server icon indicating copy to clipboard operation
Chatterbox-TTS-Server copied to clipboard

Chunking error.

Open Torlek opened this issue 7 months ago • 7 comments

Some texts consistently cause chunking to fail, resulting in chunks that contain all the remaining content. If these chunks get too large, they can end up crashing the TTS engine.

Example string: "Chapter 22: Secret Tunnel Chapter 22: Secret Tunnel

-Within the Tunnels of Alexander (wait that sounds lewd)-

Within the tunnels forged with a singular will and vision there was darkness. This area of the tunnels was hundreds of miles away from the miniature star that Alexander had wrought with magic beyond mortal means. There was only the occasional click and chirp of insectoid drones languidly roaming the depths, ordered to repair any damages that may occur by their absentee creator.

Had there been a light source, and had there been any people, the crowded and claustrophobic nature of the surroundings would be readily apparent. Buildings were stacked atop each other and wires criss-crossed the top levels like an enormous spiders web.

The structures rose and fell, ever changing in quality and materials as one explored the tunnels. It was, to all appearances, an abandoned wreck. Yet despite this not a single layer of dust could form upon the buildings surface."

If the dashes are removed from the "within the Tunnels" line chunking works properly.

Used config: server: host: 0.0.0.0 port: 8004 use_ngrok: false use_auth: false auth_username: user auth_password: password log_file_path: logs\tts_server.log log_file_max_size_mb: 10 log_file_backup_count: 5 ssl_certfile: null ssl_keyfile: null model: repo_id: chatterbox tts_engine: device: cuda predefined_voices_path: voices reference_audio_path: reference_audio default_voice_id: Emily.wav paths: model_cache: model_cache output: outputs generation_defaults: temperature: 0.8 exaggeration: 1 cfg_weight: 0.6 seed: 1775 speed_factor: 1 language: en audio_output: format: mp3 sample_rate: 24000 max_reference_duration_sec: 30 save_to_disk: false ui_state: last_text: .... last_voice_mode: predefined last_predefined_voice: Alice.wav last_reference_file: Gianna.wav last_seed: 1775 last_chunk_size: 240 last_split_text_enabled: true hide_chunk_warning: false hide_generation_warning: true theme: dark last_preset_name: Long Story Excerpt (Chunking Test) ui: title: Chatterbox TTS Server show_language_select: true max_predefined_voices_in_dropdown: 50 debug: save_intermediate_audio: false

Torlek avatar Apr 28 '26 13:04 Torlek

Reproduced and fixed in f0afcc6. Thank you for the clear repro, the example text made this easy to track down.

Root cause: the bullet-point detection regex matched any whitespace after a leading -, including newlines. The stray - at the end of (wait that sounds lewd)- followed by \n\nWithin the tunnels... got read as a single bullet item that swallowed the entire rest of the paragraph. That item was then never re-split, so all the sentences after it collapsed into one ~870-char chunk and overran the engine.

The fix tightens the pattern to require a regular space or tab after the bullet char, so - item and 1. item still split correctly but stray dashes in narrative text no longer trip it. Verified against your example, output now chunks normally at the requested 240-char target.

git pull

Closing once verified on your side, please reopen if you see any related case.

devnen avatar May 11 '26 14:05 devnen

Works on my end. I had another issue where text like this "İ̷͕n̷̠͋i̷̡̪̪̾͝͠t̷̟̼̒̋̿ǐ̴͈̦̦͊ạ̸͔̈́̇͘l̷̤̳̽i̷̟͖̙̇̚ẕ̶̘͂̄ĩ̷̛̳̺̣̅ņ̷̮̯̊͝͝g̴̮̫̻̅.̸̩̟̈̇.̴͙̙̰̄͊.̵̟̪͐̈́͘ ̵̠̆͜F̶̨͕̙͛A̵̢̡̪͒Î̴͚̩͒͘ͅL̸̫̃Ū̶̡̝̅R̶̡̐͒E̴̡̛̫͓͂

̸̬̆

̵̥̹͘M̷͙͚̽͋̂͜e̸̝̪͎͊̐̌m̶̨̭͎͒̍͐ċ̶̛̜h̴͙̫̏e̶̡̡̝̍̍͝ć̸̬ͅk̸̼͕͊ ̴̛͓̠͔̅̌N̴̡͔̄Ȏ̵̘͠T̴̟̓̆̾ ̴̛̣͘O̵̜̮̰͆K̷̡̻̄̋͛

̴̡͙͑̾

̴̟̯͐C̵̟̳͙̒o̸͚̙͇̿̃r̸̻̐t̶̗̒͗͠e̸̲̭̻̚ẋ̵̤͓͚̄̓ ̵̖̹̫̄:̸͈̯̳̊/̸̖͇̼̔̑/̷̻̣̜͊ ̶̃͜N̵̞̗̓̀̂Ŏ̴͍̥͇̂Ṭ̵͈̎ ̵̭̥̈́̄R̷̥̠̄̊̈́E̶̥͎̋͂̚Ş̴͍͍̌́P̸̩̎̂O̶̹͗̀̌͜N̵̯͎̐͗͝Ḑ̸̤͆ͅI̷̢̲̚Ṋ̸͘Ḡ̸̯̰̍

̷̲͒͊

̴̪͍̎P̷̡̠̥̍u̵͙͐̏̉p̵̫̲̞̔p̵̨̫̖̓̀ë̶͎̳̹́̋t̷̖͌ ̵̦̮̿ș̵̲̊ö̷̗̬͎́̏c̵͈͉̖̀͝k̵̲̮̉ ̷̔̾ͅ:̶̺̉͂͝/̷̠̑̆͠/̵͖͍̉͛ ̵̹͗̑̕Ḣ̸̜ͅA̴̘̱̪̽R̴̘̓̉Ḍ̸̯̥̿̂̋W̶̢̗̏͜Ą̴̌̑̚R̸̳̈́̾Ē̷̟̰̋ ̵͙͇̬̒͘F̵̘̳̱̓͛A̶̧̓U̷̠̗͑̋L̶̥̃̿̈T̸̢̲̯͆͝

̵̟̠̽

̴̮̟̅͌#̸̗͓̓͌̕#̵͉̌#̸̤͎̄D̶͚̔͝A̸̰͛͊͌M̷̮͕̎A̸̛̳̯̖G̸̨̮͇͛̿͋Ë̶̛͚̟̾ ̵̡̘̑̄͛S̸̘̽̉̚Ű̵̲̣̠S̷͎͇̣̈́Ṱ̵̚A̷̯̭̥̾Ǐ̸͈̺̝̽N̴͖͑̒͝E̴̗̳͒̀D̸̺͍̩͋

̸̘̑͑

̶͈͗̕#̷̫̰͔̅#̵͎̤̂͛#̸̬̙̺͋̾Ḑ̶̺͋̒̀A̵͍̩͆͜M̷͎̣̾A̴͈͇̍́G̶̞̈Ė̵̬̼̹̏ ̶̢͉̜̒͌S̶̼̝͌Ű̷̱Ŝ̶̜͂̑T̶̞͓͛͌A̴̼̱̅I̶̜͌Ñ̶̝͌E̴̞͚͆͜D̶͓͖͂̇̂

̴̠̯̦̾

̴̫̏͠#̵̨̼͉̂#̵̙͕̽#̷̖͛̅D̸͎͝ͅA̶̩͖̽̓̍M̸̞̪̐A̸̳̒͌G̸̙̅̿E̶̢̍̎͝ ̵̡̃̐S̶̬̱͇͌̾U̷͈͙̓̐S̷̨̯̃̔̂T̷̙̯̘̋A̶̗̓İ̶̤̼̖N̴͍͙̹̋͝E̸̺̙̹͛̽D̶̠̱̱́̀

̸̢̳̺͆

̶̣̖̟̽̑̕S̷̖̒̉̿e̸͎͍͝ļ̷̮f̶̧̟̝̈́̿-̴̰̳̳̄d̴̛͇ͅi̸̙̅a̶̽ͅg̶͙̞͆n̷͚̭͋o̸͈̐͊̈s̸̺͈̗̓̄t̵̳̔i̸͔̬̓͊c̵̪ ̷̭̜̖́̊p̵͍͉͂̆r̵̞̠̰̄͝ö̶̺́̽t̷̙͖̜ó̴̖c̵̫̮͎̆̀ơ̸͙̰̟͑̋l̵̘̂͝͠ ̴̝̜̋͐͜Â̸̧̜͌́7̸̲̻̝̒̄̉-̷̙͛͑̈P̶̬̓Ḩ̷̛̻̰̿I̵̞͋͋ ̵̻̋͑̈́:̷͈͌͋/̴̛̥̏́/̶̠͎̠̆̚ ̷̩̺͛̎̽I̷̗̔͝Ń̶̻̻͛͗I̸̳͇̜͛̃Ť̵̝̈́Ị̵̢̽͠A̷̠̦̞̐̾͝L̵̛̖̦̹̈̎I̸͚̪͌͛͜Z̴̼̫̼̚Ę̶͇̤͋͠Ḏ̵̝̿

̴̸̨͚͌̀̐̓̀

̸͇̃̋͋P̸̢͔͎̌͌͆õ̴̥̌͝ͅw̴̡͚̑̕e̵̲̍̏͠r̴̡̥̠̽̾ ̴̩̯̀̎l̵̙̹̉̒̆ͅe̵̛͍̟̤̎͑v̷̤̣̽̑ẹ̶̹͙̚l̴̛̗̞̍ ̷̫M̶͚̏I̸̭̤̔̌̚͜N̷̩͎̈́̾İ̴̗̍͛ͅM̸͙͈͈̔̇A̸͍͓̐͛L̵̘͆̈́̔

̷̡͍̫̉

̸͚̍̿̂E̸̲͈̿̍x̸̤̀̽t̴̡̟̠̂̋̎e̴͉̋r̶̢͈͂͜͝ǹ̸͚a̴͇͒l̴̰͆ ̸̟̒̄c̸̛͓̎̓ǫ̷̜̼̒n̷̡̹̤̓̏͛n̸̢̺͔̿̅ë̸̪̮́͝ç̸̐t̴͇̯̃̚͜͝i̶̞͛͗̕o̶̳͍̥̾n̶̼̊̌͛ ̴̮̦̉̄̿N̶̩͈̦̎Ǒ̵̦T̵̲̺̥̊ ̵̣A̶̯̋̕͠V̴̨͉͆̿A̶̺̘̟͊̽͠I̵̘͎͒L̴̬̏̃͝Ȧ̵͔͜Ḇ̵̛̜L̵̯͔̗͗̒͘Ĕ̸̮̀̚

Q̴̡͇̻̥͖̖̪͓͍̝̦̹̮̚͜U̶̢̨͎̮̭̺̟̞͉͍̬̝̖͕̦̐͑͊͝E̷̛̗̮͑̑̈̓͋͗̉͒͘͜͝͝R̶̖̥̦͓̲̪͉͎̼͌̆̾͐̃̓̐̒͆̉͝͝͝Y̵̼̼̱̼̭͒̍͐̾̋͜͝:̷̛̛̻͇̄̋͛͑̿͠ ̶̞͝R̴̢̛̺̻̥̈́͛̇̃̇͒̒̓̈́͊͑̚͜͝ͅE̵͎̩͔̳̘̭̘̍̽́̀̊̈́̐̇̓̽͐̀̚͘̚P̷̢͚͖̜̟͔̣̪̝̹̖̋̃̈͛̚À̸̖̘̺͈̥̈́̍͋̄͛̃̔̾͊̕ͅI̸̫̯̦̻̋͒̓̄̃R̴̛͎̫̞̰̤̘̉̾̓̂̎̊̄̊̚͠ ̶̧̢̗͉̫͇̹͈͇̎́̔͜ͅĄ̴̪̦̰͕̾̀̋̅̐S̷̢̧̮͈̞͔͌͑͐̅͆̈́́͂̓̾̊̕S̶͉̓̀̈̓̅̾̑͝ͅE̸̢̝̰̯̲̙̟͔̜̾̀͋̐́̏͊̐̽̓̃͝T̷̢̨̛̲̝̩̮̳̭̟͎͎̉͑̄̉̈́͗͘͠S̸̛͕̘̗̬̩͚̘̫̣̒̊͐̀̄̓͐̃̒̉̚͠ͅ ̵̜̪͔̤̎̃̈͘Ả̸̢̨͓̫̦̼͖̖͆̓͐͜V̶̛͈̘̮̐̏̆̌͗̍̀̆̐͒͆͂̐͝A̷̙͇̻͓̠̋͗͆̊̓̄̏̍I̶̹̗̐͂͗͆͜L̶̤̈̂͑̈́̋̋̓͊̇͘̕͠͝͝Ă̴͚̹̗̦͉͒̃́̕͝B̵̡̐̒͆̕͝L̶̨͇̻̖̳̬̹̈́͛̍̚E̵͔̩̪͓͇̱̝̰̻͜͝ͅ:̶̡̘̬̠̳̩͉̀͘͜ͅ/̷̨̤͚̙͔̱̗͒̃͑̃̃̈̓̾̽̈́̆̆̋͝/̵̨͉̠̗̘̥̦̭̫͈̯͌͊̉́̈́͝ ̷̧̢̫̱̥͎͈̟̘̟̣̫̣͛̾̒̉͝P̵̢̰̟̼̠̖̩̹̹̫͐̊͜R̵̛̹̅̄̽̄̉̆͝O̷̢̰̲̤̜̣̓̒̋̑̓̈́̎̔̔̈́͂̌͗͑ͅC̸̺͈̖̮͕͈͖̩̙͙̼̆̊͌̃͌̈́̌͆͊͜͠͝͝Ȩ̵̦̮̩̹͍̗̭͉̱͚̩͙͇̈̋͠S̴̛͓͎̮̘͇̞͚̋̎̌̃̕S̵̢̛̱̺̝̺̘̻̰͉̣̭̮͖̹̬̆̾̋͊͂̌̚͝͝Ǐ̸̱͈̳͚̎̓́͒͗̔̅́̋͂̚͜͜N̶̛̛͉̳͍̻̰͖͖̙̄̇̃̊͌̐͌̂͐̂̌̐͝G̵̜̯̝̥̮̰̺̻̖̾͐

̸̧͍͗̆

̷̢̜̭̇̔͌H̷̨͉̊ǎ̴̱͔̌̚n̶̨̐̓̚d̵͇͒̐s̴̟͒ḫ̴̤͉͂́̕a̵̬̩̹̋k̴̇̾̔ͅi̵̽̿̒͜n̷̢̏̃̋g̴̜̉̓̈́͜.̸̨̹̿͗̋.̶̥̪̄.̴̤̏

̴̘̭͛̚

̵̠̮͓̋#̴̙̦̈#̵̥͐͑#̵͖̘̫̑̓Ȑ̵̗Ę̵̮̼̒̈́͠S̵͔̝̒̇̋P̵̡͇͑̈́O̶̘̙̱̓̆̈́N̵̩̰̙͑̃S̶̢̨̩̈́͑̿E̸̥͛͘ ̶̠̥͙͌M̶͈̽e̵̳͝d̷̫̄i̸̺̹̍͊c̶̺͉͓̈̔h̵͔̥̜̍̔̒i̷̛̟̬̊͗ͅn̵͕̈́e̵̖͋̈́͑ͅ ̴͕̿m̵̯̤͍̅͑̈́a̴̬̞̿̕ṉ̷̢̐̈́ḯ̶̤̪̙̍p̶̡̾͝ḷ̶͔̽e̶̲̾͊͌ ̵̞̳͋̈́͜D̴̙̀7̷̫̉͊7̸̨̤͑̆6̴̱̂̒̇ ̶̨̈́͜Ṡ̵̰͘T̴̹̟̓̃͝Ạ̵̬͆̚T̴̛̪Ṳ̴͘S̸̡̥̎̽ͅ ̵̢̹̋N̶̩̝̤͛̌O̷̗͗̀M̶̢͙͚̾I̷͖̲̎N̴̛̤̘̠̄̈A̶̗͗̌̒" cause the engine to spaz out but I honestly felt that I was asking to much and it is most likely a chatterbox issue not a chunking issue.

Torlek avatar May 11 '26 15:05 Torlek

Thank you for confirming.

The zalgo case is preprocessing, not the model. That text is combining diacritics stacked on each character, and we hand it to the tokenizer without any unicode normalization, so it emits garbage tokens. An NFKC normalize plus a combining-mark strip before chunking would fix it. Worth a separate issue if you want me to add it.

devnen avatar May 11 '26 16:05 devnen

I fixed the diacritics issue on my end, so I don't need it. You decided if it is worth your time.

Torlek avatar May 11 '26 16:05 Torlek

I have found more evil dashes. (For context: I automated TTSing my fanfiction backlog unattended)

The problematic dashes are the leading dashes in the "THE HURRICANE" and "I STAND AND lines. As well as the MEMORIES DON'T LIE, PLEASE BELIEVE ME and I HAVE FALLEN AGAIN Lines. Some lines have leading spaces before the dash.

faulty dashes.txt

Torlek avatar May 13 '26 13:05 Torlek

Thank you for the clear repro and follow-up cases. The chunker's bullet regex was matching indented dashes and single dash-prefixed lines as list items, which collapsed all text after the match into one oversized chunk. The pattern now requires bullets at column 0 and the bullet-splitting path needs 2+ matches, so isolated dashes fall through to normal punctuation splitting. Pull commit 450de15 and test with your presets. Reopen if you see any remaining edge cases.

devnen avatar May 21 '26 21:05 devnen

Closing, the second batch of dash cases is fixed in 450de15. The bullet pattern now requires column-0 position and 2+ matches, so isolated indented dashes fall through to normal punctuation splitting instead of being treated as a list. Thank you @Torlek for the careful repro file, the leading-space cases were the missing input. Please reopen if you hit any remaining edge cases on your fanfic batch.

devnen avatar May 26 '26 19:05 devnen