Skip to main content
Whisper is OpenAI’s powerful automatic speech recognition (ASR) model that can transcribe audio in multiple languages and translate speech to English. ONNX Runtime GenAI provides optimized support for Whisper models with hardware acceleration.

Overview

Whisper models provide:
  • Multi-language support: Transcribe audio in 99 languages
  • Robust performance: Trained on 680,000 hours of multilingual data
  • Translation capability: Translate foreign language speech to English
  • Punctuation and casing: Automatic formatting of transcriptions
  • Timestamp support: Optional word-level or segment-level timestamps
Whisper models in ONNX Runtime GenAI use beam search decoding for high-quality transcriptions.

Model Architecture

Whisper uses an encoder-decoder transformer architecture:
  • Audio Encoder: Processes audio spectrograms into embeddings
  • Text Decoder: Generates transcription tokens autoregressively
  • Multi-task Framework: Supports transcription, translation, and language detection

Audio Preprocessing

Whisper expects audio to be:
  • Sampling Rate: 16 kHz
  • Format: Mono channel
  • Duration: Up to 30 seconds per segment (longer audio is automatically chunked)

Using Whisper Models

Basic Transcription

Multi-File Batch Processing

Beam Search Results

Access multiple beam search hypotheses:

Language Support

Transcribe in Different Languages

Supported Language Codes

  • <|en|> - English
  • <|es|> - Spanish
  • <|fr|> - French
  • <|de|> - German
  • <|it|> - Italian
  • <|pt|> - Portuguese
  • <|ru|> - Russian
  • <|ja|> - Japanese
  • <|ko|> - Korean
  • <|zh|> - Chinese
  • <|ar|> - Arabic
  • <|hi|> - Hindi
See Whisper documentation for the full list of 99 supported languages.

Translation to English

Translate non-English audio to English:

Audio Input Handling

Supported Audio Formats

Whisper supports common audio formats:
  • WAV
  • MP3
  • FLAC
  • OGG
  • M4A

Loading Audio Files

Audio Preprocessing

Audio is automatically preprocessed:
  1. Resampling: Converted to 16 kHz sampling rate
  2. Channel Mixing: Stereo audio converted to mono
  3. Normalization: Audio levels normalized
  4. Feature Extraction: Converted to mel-spectrogram features

Advanced Usage

Custom Search Parameters

Interactive Transcription

Performance Optimization

Choose the best execution provider for your hardware:
Best for NVIDIA GPUs. Provides fastest inference.
Adjust beam search parameters based on your needs:
Process multiple files together for better throughput:

Example Application: Audio Transcription CLI

Troubleshooting

Improve transcription quality:
  1. Increase beam search beams:
  2. Ensure correct language code:
  3. Check audio quality:
    • Ensure 16 kHz sampling rate
    • Minimize background noise
    • Use clear speech
For long audio files:

Next Steps

Phi-4 Multi-Modal

Combine audio with vision using Phi-4

Model Optimization

Optimize Whisper for faster inference

Deployment Guide

Deploy Whisper to production

API Reference

Explore the full API documentation