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
Commit ·
692ba36
1
Parent(s): b5ad047
Update README.md
Browse files350 unmodified lines3513523533543553563573584 unmodified lines3633643653663673683691 unmodified line371372373374375376377378379380381382383384385350 unmodified linesThe Whisper model is intrinsically designed to work on audio samples of up to 30s in duration. However, by using a chunkingalgorithm, it can be used to transcribe audio samples of up to arbitrary length. This is possible through Transformers[`pipeline`](https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.AutomaticSpeechRecognitionPipeline)method. Chunking is enabled by setting `chunk_length_s=30` when instantiating the pipeline. It can also be extended topredict utterance level timestamps by passing `return_timestamps=True`:```python>>> import torch4 unmodified lines>>> pipe = pipeline(>>> "automatic-speech-recognition",>>> model="openai/whisper-medium",>>> chunk_length_s=30,>>> device=device,>>> )1 unmodified line>>> ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")>>> sample = ds[0]["audio"]>>> prediction = pipe(sample.copy())["text"]" Mr. Quilter is the apostle of the middle classes, and we are glad to welcome his gospel.">>> # we can also return timestamps for the predictions>>> prediction = pipe(sample, return_timestamps=True)["chunks"][{'text': ' Mr. Quilter is the apostle of the middle classes and we are glad to welcome his gospel.','timestamp': (0.0, 5.44)}]```## Fine-TuningThe pre-trained Whisper model demonstrates a strong ability to generalise to different datasets and domains. However,350 unmodified lines3513523533543553563573584 unmodified lines3633643653663673683691 unmodified line371372373374375376377378379380381382383384385386387350 unmodified linesThe Whisper model is intrinsically designed to work on audio samples of up to 30s in duration. However, by using a chunkingalgorithm, it can be used to transcribe audio samples of up to arbitrary length. This is possible through Transformers[`pipeline`](https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.AutomaticSpeechRecognitionPipeline)method. Chunking is enabled by setting `chunk_length_s=30` when instantiating the pipeline. With chunking enabled, the pipelinecan be run with batched inference. It can also be extended to predict sequence level timestamps by passing `return_timestamps=True`:```python>>> import torch4 unmodified lines>>> pipe = pipeline(>>> "automatic-speech-recognition",>>> model="openai/whisper-large-v2",>>> chunk_length_s=30,>>> device=device,>>> )1 unmodified line>>> ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")>>> sample = ds[0]["audio"]>>> prediction = pipe(sample.copy(), batch_size=8)["text"]" Mr. Quilter is the apostle of the middle classes, and we are glad to welcome his gospel.">>> # we can also return timestamps for the predictions>>> prediction = pipe(sample.copy(), batch_size=8, return_timestamps=True)["chunks"][{'text': ' Mr. Quilter is the apostle of the middle classes and we are glad to welcome his gospel.','timestamp': (0.0, 5.44)}]```Refer to the blog post [ASR Chunking](https://huggingface.co/blog/asr-chunking) for more details on the chunking algorithm.## Fine-TuningThe pre-trained Whisper model demonstrates a strong ability to generalise to different datasets and domains. However,
README.md+7-5