Automatic Speech Recognition
Transformers
PyTorch
TensorFlow
JAX
Safetensors
whisper
audio
hf-asr-leaderboard
Eval Results (legacy)
Run this model with HF Jobs
Run openai/whisper-medium on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/openai/whisper-medium. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/openai/whisper-medium on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use openai/whisper-medium with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openai/whisper-medium with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="openai/whisper-medium")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq processor = AutoProcessor.from_pretrained("openai/whisper-medium") model = AutoModelForSpeechSeq2Seq.from_pretrained("openai/whisper-medium", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Fix imports in multilingual examples
#3
by sanchit-gandhi - opened
225 unmodified lines2262272282292302312322 unmodified lines23523623723823924024112 unmodified lines2542552562572582592602 unmodified lines263264265266267268269225 unmodified lines```python>>> from transformers import WhisperProcessor, WhisperForConditionalGeneration>>> from datasets import load_dataset>>> import torch>>> # load model and processor2 unmodified lines>>> # load dummy dataset and read soundfiles>>> ds = load_dataset("common_voice", "fr", split="test", streaming=True)>>> ds = ds.cast_column("audio", datasets.Audio(sampling_rate=16_000))>>> input_speech = next(iter(ds))["audio"]["array"]>>> model.config.forced_decoder_ids = processor.get_decoder_prompt_ids(language = "fr", task = "transcribe")>>> input_features = processor(input_speech, return_tensors="pt").input_features12 unmodified lines```python>>> from transformers import WhisperProcessor, WhisperForConditionalGeneration>>> from datasets import load_dataset>>> import torch>>> # load model and processor2 unmodified lines>>> # load dummy dataset and read soundfiles>>> ds = load_dataset("common_voice", "fr", split="test", streaming=True)>>> ds = ds.cast_column("audio", datasets.Audio(sampling_rate=16_000))>>> input_speech = next(iter(ds))["audio"]["array"]>>> # tokenize>>> input_features = processor(input_speech, return_tensors="pt").input_features225 unmodified lines2262272282292302312322 unmodified lines23523623723823924024112 unmodified lines2542552562572582592602 unmodified lines263264265266267268269225 unmodified lines```python>>> from transformers import WhisperProcessor, WhisperForConditionalGeneration>>> from datasets import Audio, load_dataset>>> import torch>>> # load model and processor2 unmodified lines>>> # load dummy dataset and read soundfiles>>> ds = load_dataset("common_voice", "fr", split="test", streaming=True)>>> ds = ds.cast_column("audio", Audio(sampling_rate=16_000))>>> input_speech = next(iter(ds))["audio"]["array"]>>> model.config.forced_decoder_ids = processor.get_decoder_prompt_ids(language = "fr", task = "transcribe")>>> input_features = processor(input_speech, return_tensors="pt").input_features12 unmodified lines```python>>> from transformers import WhisperProcessor, WhisperForConditionalGeneration>>> from datasets import Audio, load_dataset>>> import torch>>> # load model and processor2 unmodified lines>>> # load dummy dataset and read soundfiles>>> ds = load_dataset("common_voice", "fr", split="test", streaming=True)>>> ds = ds.cast_column("audio", Audio(sampling_rate=16_000))>>> input_speech = next(iter(ds))["audio"]["array"]>>> # tokenize>>> input_features = processor(input_speech, return_tensors="pt").input_features
README.md+4-4