Repository navigation
OmniVoice: apply the tokenizer's NFC normalizer to input text - #1116
Conversation
|
@kawshikbuet17 Thanks! I confirmed that the missing NFC normalization causes the tokenizer mismatch. However, we already vendor |
OmniVoice's tokenizer.json declares an NFC normalizer, which Hugging Face tokenizers (and so Python OmniVoice) apply before BPE. audio.cpp encoded the raw text, so non-NFC input (common in Bengali: precomposed য় ড় ঢ়, or ো/ৌ typed as two code points) produced different token IDs than Python. Normalize in OmniVoiceTextTokenizer::encode() with the vendored utf8proc, the same way Drama3 and Plapre do, and link the omnivoice model with utf8proc_vendor. This covers reference text, target text, style prompt and the segments around nonverbal tags. Duration estimation still uses the raw text, as in Python.
a7b5566 to
037791d
Compare
|
@0xShug0 |
|
@kawshikbuet17 Thanks! PR merged. |
Summary
OmniVoice's
tokenizer.jsondeclares anNFCnormalizer, which Hugging Face tokenizers (and so Python OmniVoice) apply before BPE. audio.cpp encoded raw text, so non-NFC input produced different token IDs than Python. This is common in Bengali: precomposed য় ড় ঢ় (U+09DF/09DC/09DD), or ো / ৌ typed as two code points.Changes
OmniVoiceTextTokenizer::encode()NFC-normalizes its input with the vendored utf8proc (UTF8PROC_STABLE | UTF8PROC_COMPOSE), following Drama3. This covers reference text, target text, style prompt and the segments around nonverbal tags. Duration estimation still uses the raw text, as in Python.omnivoicemodel linksutf8proc_vendor.Testing
unicode_normalization_testandtext_normalization_testpass.audiocpp_cliwith non-NFC Bengali text works.