whisper-large-v3-turbo

openai

Whisper-large-v3 Turbo is a state-of-the-art model for automatic speech recognition (ASR) and speech translation

Python usage

Overview

ElasticModels are the models produced by TheStage AI ANNA: Automated Neural Networks Accelerator. ANNA allows you to control model size, latency and quality with a simple slider movement, routing different compression algorithms to different layers. For each model, we have produced a series of optimized models:

XL: Mathematically equivalent neural network, optimized with our DNN compiler.

L: Near lossless model, with less than 1% degradation obtained on corresponding benchmarks.

M: Faster model, with accuracy degradation less than 1.5%.

S: The fastest model, with accuracy degradation less than 2%.

Models can be accessed via TheStage AI Python SDK: ElasticModels, or deployed as Docker containers with REST API endpoints (see Deploy section).

System Requirements

PropertyValue
GPUL40s, RTX 4090, RTX 5090, H100
Python Version3.10-3.12
CPUIntel/AMD x86_64
CUDA Version12.8+

TheStage AI Access Token Setup

Install TheStage AI CLI and setup API token:

pip install thestage
thestage config set --access-token <YOUR_ACCESS_TOKEN>

ElasticModels

Elastic Models provides the same interface as HuggingFace Transformers. Here is an example of how to use the whisper-large-v3-turbo model.

Installation

pip install 'thestage-elastic-models[nvidia]' \
    --extra-index-url https://thestage.jfrog.io/artifactory/api/pypi/pypi-thestage-ai-production/simple
pip install datasets==3.6.0 librosa soundfile  # only needed to load audio for the example below

Usage

import torch
from elastic_models.transformers import AutoModelForSpeechSeq2Seq
from transformers import AutoProcessor

model_name = "openai/whisper-large-v3-turbo"
hf_token = ''
device = torch.device("cuda")

processor = AutoProcessor.from_pretrained(
    model_name, token=hf_token
)
model = AutoModelForSpeechSeq2Seq.from_pretrained(
    model_name,
    token=hf_token,
    torch_dtype=torch.float16,
    mode='S'
).to(device)

# Load audio file
from datasets import load_dataset
dataset = load_dataset(
    "hf-internal-testing/librispeech_asr_dummy",
    "clean", split="validation"
)
audio_sample = dataset[0]["audio"]

# Process audio
input_features = processor(
    audio_sample["array"],
    sampling_rate=audio_sample["sampling_rate"],
    return_tensors="pt"
).input_features.to(device, dtype=torch.float16)

# Generate transcription
with torch.inference_mode():
    predicted_ids = model.generate(input_features)

transcription = processor.batch_decode(
    predicted_ids, skip_special_tokens=True
)[0]

print(f"Transcription: {transcription}")