Machine LearningONNX ExportOngoing Project

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.

PyTorchONNXONNX RuntimeQwen3Hugging FacePythonTypeScript

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.

ONNX Inference ArchitectureModular

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.

Logits ProcessingTop-K SamplingToken Scheduling
↓

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.

04 / Generation

Iterative Audio Generation

The generation loop is implemented outside the ONNX models, coordinating repeated inference calls and updating audio tokens.

PYTHON / INFERENCE LOOP
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.

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

Related Project

OmniVoice Web UI

Ongoing browser-based implementation using the exported ONNX models.

07 / Progress

Project Status

Current development milestones and remaining work.

Development ProgressOngoing
✓Explore original OmniVoice inferenceDone
✓Separate LLM componentsDone
✓Inspect tensor shapesDone
✓Export tokenizer to ONNXDone
✓Export Qwen3 and OmniVoice componentsDone
✓Test modular ONNX inferenceDone
Browser-based inference integration
Optimize browser performance