Skip to content

OmniVoice: make the audio tokenizer codebook weight type configurable - #1129

Open
kawshikbuet17 wants to merge 4 commits into
0xShug0:mainfrom
kawshikbuet17:omnivoice
Open

kawshikbuet17 wants to merge 4 commits into
0xShug0:mainfrom
kawshikbuet17:omnivoice

Conversation

@kawshikbuet17

Copy link
Copy Markdown
Contributor

c6dd5dd pinned four audio tokenizer tensors to f32 so runtime q8_0 tokenizer loading works:
the codebooks, the codebook score matrix, the semantic feature projection and fc2. Before that
commit they followed omnivoice.audio_tokenizer_weight_type, so f16 users got them in f16.

This adds omnivoice.audio_tokenizer_codebook_weight_type (native, f32, f16, bf16) for
those four tensors, so the pre-c6dd5dd8 behaviour can be selected when needed (for example, to
reproduce outputs from older builds).

  • The default is f32, so nothing changes unless the option is set.
  • Quantized types are rejected with a clear error, since quantizing these tensors is what broke
    runtime q8_0 tokenizer loading.
  • The score bias stays f32, as it was before c6dd5dd.
  • Documented in docs/models/omnivoice.md.

Checked with audiocpp_cli on CUDA (seed 42, f16 generator and tokenizer):

  • option unset vs =f32: bit-identical WAV
  • =f16: runs, different WAV
  • =q8_0: rejected with the new error message

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.
c6dd5dd pinned the codebooks, codebook score matrix, semantic feature
projection and fc2 to f32 so runtime q8_0 tokenizer loading works. Before
that, they followed omnivoice.audio_tokenizer_weight_type.

Add omnivoice.audio_tokenizer_codebook_weight_type (native, f32, f16, bf16)
for these four tensors. The default stays f32, so outputs do not change
unless the option is set. Quantized types are rejected.
@0xShug0

0xShug0 commented Oct 29, 2026

Copy link
Copy Markdown
Owner

@kawshikbuet17 Two minor issues:

  1. Using the published OmniVoice Q8 GGUF for voice cloning with omnivoice.audio_tokenizer_codebook_weight_type=native causes an abort. Both main and the PR’s default configuration work. Please reject unsupported native tensor types with a clear error.
  2. Please add the new option to model_specs/omnivoice.json.

…n to the model spec

codebook_weight_type=native keeps the packaged type, so on the published
Q8_0 GGUF it loaded the feature projection and fc2 as q8_0 and aborted.
Check the stored type up front and fail with a clear error unless it is
f32, f16, or bf16. Add audio_tokenizer_codebook_weight_type to
model_specs/omnivoice.json.
@kawshikbuet17

Copy link
Copy Markdown
Contributor Author

@0xShug0 Thanks, both fixed in cb9683a.

  1. audio_tokenizer_codebook_weight_type=native now checks the packaged types of the
    affected tensors (semantic feature projection, codebooks, fc2) before loading, and
    fails with a clear error unless they are f32/f16/bf16. With the published Q8_0 GGUF:

    OmniVoice audio tokenizer codebook_weight_type=native requires f32, f16, or bf16
    tensors, but semantic_model.feature_projection.projection.weight is q8_0 in this
    package; use codebook_weight_type=f32, f16, or bf16

  2. Added the option to model_specs/omnivoice.json (values native|f32|f16|bf16,
    default f32). model_spec_system_test passes.

Checked with audiocpp_cli on CUDA:

  • Q8_0 GGUF, default and =f16: run
  • Q8_0 GGUF, =native: rejected with the error above
  • f32 safetensors, =native vs default: bit-identical WAV

@0xShug0 0xShug0 added the ready label Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants