BOS Omnivoice on N1A0
Overview
OmniVoice is an omnilingual zero-shot text-to-speech (TTS) model built on a diffusion language model (masked / non-autoregressive iterative decoding) instead of the usual autoregressive token-by-token decoder.
Pipeline:
| Component | Detail |
|---|---|
| Backbone | Qwen3, 28 decoder layers, hidden 1024, 16 heads / 8 KV heads (GQA), head_dim 128, FFN 3072, RoPE theta 1e6, RMSNorm eps 1e-6 |
| Audio codec | Higgs-Audio-V2 tokenizer — HuBERT semantic encoder + DAC acoustic encoder + residual vector quantizer |
| Codebooks | 8 x 1025 tokens (1024 = mask id), codebook weights [8, 8, 6, 6, 4, 4, 2, 2] |
| Decoding | Iterative masked (diffusion-style) decoding with classifier-free guidance |
| Output | 24 kHz mono waveform |
Scope
- Checkpoint:
k2-fsa/OmniVoice(HuggingFace Hub, default for every runner). - Auxiliary models:
eustlb/higgs-audio-v2-tokenizer(codec),openai/whisper-large-v3-turbo(optional reference-text ASR). - Platform: BOS N1A0 / Blackhole, single device (
device_id=0), 4 x 5 compute-core grid (compute_with_storage_grid_size=(5, 4)= 20 cores) for the LLM decoder; the audio-tokenizer modules auto-size their grid fromdevice.compute_with_storage_grid_size(). - Backends:
pytorch(reference, CPU/CUDA/XPU/MPS) andttnn(hybrid TT-Metal + PyTorch host glue). - Supported modes:
- Voice clone —
--ref-audio(+ optional--ref-text, auto-transcribed when omitted) - Voice design —
--instructcomma-separated attributes from the supported vocabulary, no reference audio - Auto — neither reference nor instruction; the model picks a voice
- Voice clone —
- Batch size: 1 request at a time (the guided forward internally runs a conditional + unconditional pair).
Repository layout
| Path | Purpose |
|---|---|
| assets/ | Reference audio: demo/ (short samples) and beckmark/ (LibriSpeech clips) |
| evaluation/ | LibriSpeech subset builder and batch generation driver |
| reference/ | Pure PyTorch reference implementation (omnivoice.py, modules/, cli/) |
| tests/ | Unit, smoke, real-device and Tracy PCC tests |
| tt/ | TTNN implementation: omnivoice.py, modules/llm, modules/audio_tokenizer, static_embedding_cache.py, target_audio_head.py |
| utils/ | Shared audio I/O, text normalization, duration estimation, metric logging |
| backends.py | Backend enum + load_model() dispatcher |
| run_model.py | Single-request inference runner (the only entry point) |
| pyproject.toml | Dependencies, extras (tn, eval), ruff config |
Every caller goes through backends.py, which dispatches to either the
PyTorch or TTNN backend implementation. Switching backend is a single CLI flag.
Setup environment
From the repository root:
cd $TT_METAL_HOME
./create_venv.sh omnivoice
source env_set.sh omnivoice
Supported CLI Arguments
Shared by run_model.py and evaluation/generate_audio.py.
| Flag | Type | Default | Description |
|---|---|---|---|
--backend | pytorch | ttnn | pytorch( ttnn in generate_audio.py) | Inference backend |
--model | str | k2-fsa/OmniVoice | Checkpoint dir or HF repo |
--device | str | auto | Torch device (cuda > xpu > mps > cpu) |
--text | str | required | Text to synthesize |
--output | path | output.wav | Output WAV path |
--language | str | None | Language hint |
--ref-audio / --ref_audio | path | None | Reference audio for voice cloning |
--ref-text / --ref_text | str | None | Reference transcript (ASR-filled when omitted) |
--instruct | str | None | Comma-separated attributes from the supported vocabulary (voice design mode; not free text) |
--duration | float | None | Force output duration (sec) |
--speed | float | 1.0 | Speaking-rate multiplier |
--num-step / --num_step | int | 16 | Iterative unmasking steps |
--guidance-scale | float | 1 | Classifier-free guidance scale |
--t-shift | float | 0.1 | Masking-schedule time shift |
--denoise | bool | True | Denoise the reference audio |
--preprocess-prompt | bool | True (generate_audio.py only) | Normalize/prepare the reference prompt |
--postprocess-output | bool | True | Post-process the generated waveform |
--layer-penalty-factor | float | 5.0 | Per-codebook layer penalty during unmasking |
--position-temperature | float | 5.0 | Position sampling temperature |
--class-temperature | float | 0.0 | Token (class) sampling temperature |
--cache | flag | off | Reuse the reference audio-tokenizer output from TT DRAM. Requires --backend ttnn and --ref-audio. run_model.py only. |
--benchmark | flag | off | Benchmark timing and metric logging |
run_model.py
Single request, end to end. It opens the TTNN device, enables the program cache,
loads the model, runs 3 warm-up generations, then one synchronized timed
generation, and saves the generated WAV file. If --benchmark is provided, the script additionally logs the complete benchmark metrics.
cd $TT_METAL_HOME
python models/bos_model/audio/omnivoice/run_model.py \
--backend ttnn \
--text "Excuse me, could you tell me how to get to the nearest post office? Sure! Go straight for two blocks, then turn left at the traffic light. It's on your right. Thank you so much!" \
--ref-audio models/bos_model/audio/omnivoice/assets/demo/ref_audio2.wav \
--ref-text "Hello, how are you? I'm fine, thankyou, and you?" \
--guidance-scale 1 \
--output output.wav
With --cache, the reference audio is tokenized once into TT DRAM before the
timed run; the runner then asserts tokenizer_encode_count did not increase, so
a silent cache miss fails loudly instead of quietly costing latency.
Voice design instructions
--instruct accepts a closed vocabulary of voice attributes, not a free-text
style prompt. Combine attributes with a comma and a space for English, or a
full-width comma (,) for Chinese. Choose no more than one value from each
mutually exclusive category.
| Category | Valid English values | Valid Chinese values |
|---|---|---|
| Gender | male, female | 男, 女 |
| Age | child, teenager, young adult, middle-aged, elderly | 儿童, 少年, 青年, 中年, 老年 |
| Pitch | very low pitch, low pitch, moderate pitch, high pitch, very high pitch | 极低音调, 低音调, 中音调, 高音调, 极高音调 |
| Voice quality | whisper | 耳语 |
| Accent (English only) | american accent, british accent, australian accent, chinese accent, canadian accent, indian accent, korean accent, portuguese accent, russian accent, japanese accent | — |
| Dialect (Chinese only) | — | 河南话, 陕西话, 四川话, 贵州话, 云南话, 桂林话, 济南话, 石家庄话, 甘肃话, 宁夏话, 青岛话, 东北话 |
Do not mix English and Chinese attributes, or an English accent with a Chinese
dialect. Values must match the vocabulary: for example, use low pitch, not
low-pitched.
English voice-design example:
python models/bos_model/audio/omnivoice/run_model.py \
--backend ttnn \
--text "Welcome to today's program." \
--instruct "female, young adult, low pitch, american accent" \
--output output.wav
Chinese voice-design example:
python models/bos_model/audio/omnivoice/run_model.py \
--backend ttnn \
--text "欢迎收听今天的节目。" \
--instruct "女,青年,低音调,河南话" \
--output output.wav
Librispeech Evaluation
Batch generation over a LibriSpeech-style dataset. Full details in the evaluation README.
cd $TT_METAL_HOME
# 1. build a packaged LibriSpeech subset (audio/ + metadata.parquet)
python models/bos_model/audio/omnivoice/evaluation/downloader.py \
--num-rows 10 --seed 42 \
--output-dir models/bos_model/audio/omnivoice/evaluation/librispeech_subset
# 2. generate audio on device
python models/bos_model/audio/omnivoice/evaluation/generate_audio.py \
--backend ttnn \
--dataset-root models/bos_model/audio/omnivoice/evaluation/librispeech_subset \
--num-samples 10 --selection-seed 42 --generation-seed 42 \
--output-dir models/bos_model/audio/omnivoice/evaluation/results
# 3. WER evaluation (optional)
python models/bos_model/audio/omnivoice/evaluation/eval_wer.py
Tests
Tests are located in the tests directory and use pytest with real device artifacts.
All integration tests require:
- TT hardware (N1A0 device)
- Captured real-module artifacts in
tests/artifacts/real_major_modules.pt
Test matrix
| Test | Module | Type | Command |
|---|---|---|---|
test_llm_real_pcc | Qwen3 LLM | Integration | pytest tests/test_llm_pcc.py::test_llm_real_pcc -v |
test_semantic_encoder_real_pcc | HuBERT semantic encoder | Integration | pytest tests/test_semantic_encoder_pcc.py::test_semantic_encoder_real_pcc -v |
test_acoustic_pcc | DAC acoustic encoder | Integration | pytest tests/test_acoustic_pcc.py -v |
test_hubert_pcc | HuBERT full stack | Integration | pytest tests/test_hubert_pcc.py -v |
test_quantizer_pcc | RVQ quantizer | Integration | pytest tests/test_quantizer_pcc.py -v |
test_audio_token_update_ops | Audio token masking ops | Integration | pytest tests/test_audio_token_update_ops.py -v |
Running tests
Before running tests, capture real-module artifacts:
cd $TT_METAL_HOME
python models/bos_model/audio/omnivoice/tests/capture_all_real_artifacts.py
Run individual tests:
cd $TT_METAL_HOME
# LLM (Qwen3 decoder) PCC test
pytest models/bos_model/audio/omnivoice/tests/test_llm_pcc.py::test_llm_real_pcc -v
# Semantic encoder (HuBERT) PCC test
pytest models/bos_model/audio/omnivoice/tests/test_semantic_encoder_pcc.py::test_semantic_encoder_real_pcc -v
# Acoustic encoder (DAC) PCC test
pytest models/bos_model/audio/omnivoice/tests/test_acoustic_pcc.py -v
# HuBERT full stack PCC test
pytest models/bos_model/audio/omnivoice/tests/test_hubert_pcc.py -v
# RVQ quantizer PCC test
pytest models/bos_model/audio/omnivoice/tests/test_quantizer_pcc.py -v
# Audio token masking operations test
pytest models/bos_model/audio/omnivoice/tests/test_audio_token_update_ops.py -v