ONNX format of voxreality/whisper-small-el-adapters model

Model inference example:

from optimum.onnxruntime import ORTModelForSpeechSeq2Seq
from transformers import WhisperProcessor
from datasets import Audio, load_dataset

# load model and processor
model_id = "voxreality/whisper-small-el-adapters-onnx"
processor = WhisperProcessor.from_pretrained(model_id)
model = ORTModelForSpeechSeq2Seq.from_pretrained(model_id)
forced_decoder_ids = processor.get_decoder_prompt_ids(language="greek", task="transcribe")

# Load streaming dataset and read first audio sample
ds = load_dataset("mozilla-foundation/common_voice_11_0", "el", split="test", streaming=True)
ds = ds.cast_column("audio", Audio(sampling_rate=16_000))
input_speech = next(iter(ds))["audio"]
input_features = processor(input_speech["array"], sampling_rate=input_speech["sampling_rate"], return_tensors="pt").input_features

# Generate token ids (without 'use_adapters', as it is not needed)
predicted_ids = model.generate(input_features, forced_decoder_ids=forced_decoder_ids)

# Decode token ids to text
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)

print(transcription)
Downloads last month
4
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support