thewhisper-large-v3-turbo
TheStageAI
whisper-large-v3-turbo model optimized to work on audio chunks of different duration
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
| Property | Value |
|---|---|
| GPU | L40s, RTX 4090, RTX 5090, H100 |
| Python Version | 3.10-3.12 |
| CPU | Intel/AMD x86_64 |
| CUDA Version | 12.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 thewhisper-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 belowUsage
import torch
from elastic_models.transformers import AutoModelForSpeechSeq2Seq
from transformers import AutoProcessor
model_name = "TheStageAI/thewhisper-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}")TheWhisper SpeechKit
TheWhisper can also be used via thestage_speechkit for NVIDIA and Apple Silicon inference, including real-time streaming.
Installation
# Install ffmpeg (required for audio processing) # Ubuntu/Debian: apt install ffmpeg # macOS: brew install ffmpeg git clone https://github.com/TheStageAI/TheWhisper.git cd TheWhisper pip install .[nvidia] # or pip install .[apple] for Apple Silicon
For TheStage AI optimized engines (NVIDIA only):
pip install thestage-elastic-models[nvidia] --extra-index-url https://thestage.jfrog.io/artifactory/api/pypi/pypi-thestage-ai-production/simple
NVIDIA Usage
from thestage_speechkit.nvidia import ASRPipeline
model = ASRPipeline(
model='TheStageAI/thewhisper-large-v3-turbo',
model_size='S',
chunk_length_s=15,
batch_size=32,
device='cuda'
)
result = model(
"path_to_your_audio.wav",
chunk_length_s=15,
generate_kwargs={'do_sample': False, 'num_beams': 1, 'use_cache': True}
)
print(result["text"])Apple Silicon Usage
from thestage_speechkit.apple import ASRPipeline
model = ASRPipeline(
model='TheStageAI/thewhisper-large-v3-turbo',
model_size='S',
chunk_length_s=10
)
result = model(
"path_to_your_audio.wav",
chunk_length_s=10,
generate_kwargs={'do_sample': False, 'num_beams': 1, 'use_cache': True}
)
print(result["text"])Streaming
from thestage_speechkit.streaming import StreamingPipeline, MicStream, StdoutStream
streaming_pipe = StreamingPipeline(
model='TheStageAI/thewhisper-large-v3-turbo',
model_size='S',
chunk_length_s=15,
platform='apple',
language='en'
)
mic_stream = MicStream(step_size_s=0.5)
output_stream = StdoutStream()
while True:
chunk = mic_stream.next_chunk()
if chunk is not None:
approved_text, assumption = streaming_pipe(chunk)
output_stream.write(approved_text, assumption)
else:
break