Skip to content

pocket_tts: honour capitalize_first_letter from config.yaml - #1229

Merged
0xShug0 merged 1 commit into
0xShug0:mainfrom
AfriSpeech:pocket-tts-capitalize-first-letter
Nov 7, 2026
Merged

0xShug0 merged 1 commit into
0xShug0:mainfrom
AfriSpeech:pocket-tts-capitalize-first-letter

Conversation

@michsethowusu

Copy link
Copy Markdown
Contributor

What

Upstream pocket-tts configs have a capitalize_first_letter key, and TTSModel capitalizes the first letter of the prompt only when it is true. audio.cpp's Pocket TTS path always capitalized. This PR reads the key from config.yaml and skips the capitalization when it is false.

The default is true, so the built-in models and any config without the key take exactly the same code path as before. Only a config that sets capitalize_first_letter: false behaves differently.

Why

Pocket TTS fine-tunes whose text input is lowercase-only break without it. Africa TTS (92 African languages plus English) reads IPA from a 4,000-piece SentencePiece tokenizer. Turning akʷaaba into Akʷaaba feeds the model a piece it never saw in training. Its config.yaml sets capitalize_first_letter: false, as pocket-tts expects.

Changes

  • PocketTTSModelConfig / descriptor: new capitalize_first_letter (default true), read with optional_bool(parsed, "capitalize_first_letter", true).
  • prepare_pocket_tts_text: capitalizes only when the flag is set. The offline prompt path and the sentence-chunking path both pass it through.

Validation

Run on Linux x86-64, CPU backend, with this patch applied to 04a5877:

  • Africa TTS, safetensors and GGUF (f16, q8_0). I converted it with audiocpp_gguf --family pocket_tts and ran it through audiocpp_cli and the C API (offline and streaming).
    • The prompt stays lowercase.
    • Output matches the PyTorch reference: high-band energy within about 1–3 dB per language, loudness within about 1 dB.
    • Omnilingual ASR CER is 4.0% on a five-language spot check, against 3.8% for PyTorch.
  • Built-in models. The capitalization block is unchanged and runs whenever the key is absent or true. Built-in defaults set no key, so they keep true.

🤖 Generated with Claude Code

Upstream pocket-tts configs carry capitalize_first_letter (TTSModel capitalizes the first
letter only when it is true). audio.cpp always capitalized, which breaks Pocket TTS fine-tunes
whose input is lowercase-only, such as IPA: 'a' -> 'A' is a token the model never saw.

Read the key from config.yaml (default true, so the built-in models and configs without the key
behave exactly as before) and skip the capitalization when it is false.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@0xShug0
0xShug0 merged commit d2b2076 into 0xShug0:main Nov 7, 2026
7 checks passed
@0xShug0

0xShug0 commented Nov 7, 2026

Copy link
Copy Markdown
Owner

@michsethowusu Thanks for the 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