OmniVoice ONNX
Exploring and converting the OmniVoice inference pipeline into modular ONNX models, with the goal of enabling browser-based inference using ONNX Runtime Web.
01 / Overview
Project Overview
Understanding the original architecture and making its inference pipeline modular.
Modular ONNX Export
Instead of exporting the entire architecture as one model, individual components are separated and exported into independent ONNX models. This makes each component easier to inspect, test, and integrate.
Browser-based Inference
The exported models are designed to be integrated into JavaScript applications using ONNX Runtime Web, opening the possibility of running OmniVoice inference directly in the browser.
02 / Architecture
Inference Pipeline
The original PyTorch pipeline is decomposed into smaller ONNX components and connected through a modular inference workflow.
Input
Text Prompt
Text tokens and generation configuration
Optional Input
Reference Audio
Audio waveform and reference transcription
Audio Encoding
Higgs Audio V2 Tokenizer Encoder
Convert reference audio into audio tokens.
OmniVoice Model
Text Processing
Qwen3 Input Embeddings
Audio Processing
OmniVoice Audio Embeddings
Qwen3 Language Model
Process combined text and audio embeddings.
OmniVoice Audio Heads
Predict audio token logits across codebooks.
Iterative Generation
Audio Token Generation
Repeated forward passes, classifier-free guidance, confidence scoring, and scheduled token updates until generation is complete.
Output
Higgs Audio V2 Tokenizer Decoder
Decode generated audio tokens into a waveform at 24 kHz.
Simplified architecture based on the current ONNX inference implementation. The reference audio encoder is used for voice cloning workflows.
03 / Exported Models
ONNX Components
Each component is exported independently and stored in its own directory on Hugging Face.
Qwen3
Language model backbone
Qwen3 Input Embeddings
Text token embeddings
Audio Embeddings
Audio codebook embeddings
Audio Heads
Audio token prediction heads
Tokenizer Encoder
Reference audio encoding
Tokenizer Decoder
Generated audio decoding
04 / Generation
Iterative Audio Generation
The generation loop is implemented outside the ONNX models, coordinating repeated inference calls and updating audio tokens.
with torch.inference_mode():
for step in range(gen_config.num_step):
batch_logits = forward(
input_ids=batch_input_ids,
audio_mask=batch_audio_mask,
attention_mask=batch_attention_mask,
)
batch_input_ids, tokens = process_batch_logits(
batch_logits,
B,
step,
batch_input_ids,
schedules,
c_lens,
layer_ids,
tokens,
gen_config,
short_task,
config.audio_mask_id,
)The forward function executes the separated ONNX sessions, while the iterative generation logic remains in Python. This separation also provides a reference for implementing the same orchestration in TypeScript.
05 / Experiments
Development Notebooks
A step-by-step record of the exploration, model separation, ONNX conversion, and validation process.
OmniVoice Simple Inference
Explore the original PyTorch inference pipeline.
Separate LLM Parts
Separate the LLM architecture into individual components.
Simple Inference with Separated Models
Reconstruct inference using separated components.
Check Input Output Shape
Inspect model inputs, outputs, and tensor dimensions.
Audio Tokenizer - Convert ONNX
Export the Higgs Audio V2 tokenizer to ONNX.
Audio Tokenizer - Test ONNX
Validate the exported audio tokenizer.
LLM Parts - Convert ONNX
Export OmniVoice components into ONNX format.
LLM Qwen3 - Convert ONNX
Export the Qwen3 language model.
LLM Input Embeddings - Convert ONNX
Export the Qwen3 input embedding layer.
ONNX - Simple Inference
Run the complete modular inference pipeline using ONNX.
06 / Browser Integration
Running ONNX in the Browser
The long-term goal is to run the modular inference pipeline directly in a JavaScript environment.
ONNX Runtime Web
JavaScript / TypeScript inference
Since each model is available as an independent ONNX file, the components can be loaded into individual ONNX Runtime Web sessions. The inference orchestration, tensor preparation, iterative generation, and audio decoding can then be implemented in TypeScript.
Model Sessions
Load individual ONNX models
Inference Runtime
WebAssembly / WebGPU
Pipeline Logic
TypeScript orchestration
07 / Progress
Project Status
Current development milestones and remaining work.