Repository navigation
pocket_tts: end the prompt like the reference and PocketTTS Small - #1368
Conversation
Port _ensure_terminal_punctuation from PocketTTS Small: past closing quotes and brackets, a trailing comma, colon or dash becomes a period, and any other ending that is not a sentence mark gets a period after the closers. Before, only a final letter or digit got one.
|
@unaltolga Thanks for the PR. Two issues:
Input:
Please use the existing
Input:
|
…with their sentence Gradium Phonon shares the session but its upstream only adds a period after a final letter or digit. PocketTTSImplementation now carries the prompt punctuation rule; PocketTTS takes the reference rule and Gradium keeps the old one. With the reference ending, a prompt that ends in a dash and a closing quote became 'who.”' and the splitter left the quote as a chunk of its own. The splitter now skips the closers right after a sentence mark, like the reference's _skip_closers, for PocketTTS only.
|
Thanks for checking both. Pushed 5a2a8bc:
The 24-line text and token check against the reference still matches. |
|
@unaltolga Thanks! PR merged! |
What
prepare_pocket_tts_textadded a period only when the prompt ended in a letter or a digit. The reference (_ensure_terminal_punctuationin pocket-ttsprepare_text_prompt) and this repo's own PocketTTS Small do more. Past any closing quotes or brackets, a sentence mark is kept, a trailing comma, semicolon, colon, hyphen or dash becomes a period, and any other ending gets a period after the closers. The model is trained on sentences that end in one of.!?….He looked up and said "we should go home"He looked up and said "we should go home".The meeting moved to Friday (after lunch)The meeting moved to Friday (after lunch).Bring the maps, the water, and the tent,Bring the maps, the water, and the tent.She paused for a moment -She paused for a moment.Tickets cost 25 €Tickets cost 25 €.Das Treffen ist am Freitag –Das Treffen ist am Freitag ,Das Treffen ist am Freitag.Prends les cartes, l’eau et la tente,Prends les cartes, l'eau et la tente,Prends les cartes, l'eau et la tente.Changes
prepare_pocket_tts_textis now the onepocket_tts_small/conditioning.cppuses.is_letter_or_digithad no other caller and is removed. An accented final letter still gets its period (C'est réglé.), because the new rule appends one after anything that is not a sentence mark.Validation
macOS 27.2 on an Apple M2, CPU backend, with the q8_0 packages. The text check and
ctestare oncf49294; the WER runs were onfe6d153, and nothing undersrc/models/pocket_ttshas changed since.€,…and sentence marks. I compared them with pocket-ttsprepare_text_promptfrom main (a4a6054), called with that language's upstream config and the package's owntokenizer.model. The prepared text and the token ids match on all 24 lines. On main, 14 of them differ.audiocpp_clibuilt from main and from this branch (seeds 1 to 4; voicealba,cosettefor French). I transcribed them with Whisper small and scored WER against the words to be spoken. The sentences are short, and the model reads most of them correctly without the period: 360 words, main 7.8%, this PR 6.4%; 3 sentences better, 0 worse, 11 the same. So the main reason for the change is to match the reference and PocketTTS Small.ctest: 115 of 119 pass from the build directory, and the other 4 pass when run from the repository root, as in pocket_tts: apply the config's replace_characters like the reference #1339 and pocket_tts: give the built-in defaults the upstream text options #1352.AI disclosure: written with Claude Code (Claude Opus 5.5). I reviewed the change, and the results above are from real runs on my Mac.