--- pipeline_tag: automatic-speech-recognition license: apache-2.0 base_model: openai/whisper-large-v3 library_name: kerasformers tags: - keras - kerasformers - whisper - automatic-speech-recognition - audio - multilingual - arxiv:2212.04356 - pytorch - jax - tf --- ## ***See [our collection](https://huggingface.co/collections/kerasformers/whisper-6a6ac856710a03d7d2e207b6) for all versions of Whisper.*** # Run Whisper with Keras 3: JAX, PyTorch, or TensorFlow [![GitHub](https://img.shields.io/badge/GitHub-KerasFormers-black?logo=github)](https://github.com/IMvision12/KerasFormers) [![Docs](https://img.shields.io/badge/Docs-Whisper-blue)](https://imvision12.github.io/KerasFormers/whisper/) [![Collection](https://img.shields.io/badge/HF-Whisper%20collection-yellow)](https://huggingface.co/collections/kerasformers/whisper-6a6ac856710a03d7d2e207b6) # kerasformers/whisper_large_v3 Paper: [Robust Speech Recognition via Large-Scale Weak Supervision (arXiv:2212.04356)](https://arxiv.org/abs/2212.04356) · [HF Papers](https://huggingface.co/papers/2212.04356) Whisper is a **multilingual** encoder-decoder ASR model trained on large-scale weak supervision. Use `task="transcribe"` to keep the source language or `task="translate"` to render English. Pass `language=None` to let the model detect the spoken language. Output is cased and punctuated. For more details on the model, please go to the upstream [model card](https://huggingface.co/openai/whisper-large-v3). Pure-**Keras 3** conversion of [`openai/whisper-large-v3`](https://huggingface.co/openai/whisper-large-v3) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**. This is an **ASR** checkpoint (`WhisperConditionalGenerate`, 128 mel bins). ## ✨ Quick start ```python import os os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow" import soundfile as sf from kerasformers.models.whisper import ( WhisperProcessor, WhisperConditionalGenerate, ) model = WhisperConditionalGenerate.from_weights("kerasformers/whisper_large_v3") processor = WhisperProcessor.from_weights("kerasformers/whisper_large_v3") audio, sr = sf.read("your_audio.wav", dtype="float32") # 16 kHz mono # task="transcribe" keeps the source language; "translate" -> English. text = model.generate(audio, processor, language="en", task="transcribe") print(repr(text[0])) ``` Load any Whisper variant the same way with `from_weights("kerasformers/")`: | Variant | Hub | Notes | |---|---|---| | `whisper_tiny` | [`kerasformers/whisper_tiny`](https://huggingface.co/kerasformers/whisper_tiny) | 39M | | `whisper_base` | [`kerasformers/whisper_base`](https://huggingface.co/kerasformers/whisper_base) | 74M | | `whisper_small` | [`kerasformers/whisper_small`](https://huggingface.co/kerasformers/whisper_small) | 244M | | `whisper_medium` | [`kerasformers/whisper_medium`](https://huggingface.co/kerasformers/whisper_medium) | 769M | | `whisper_large` | [`kerasformers/whisper_large`](https://huggingface.co/kerasformers/whisper_large) | 1.55B | | `whisper_large_v2` | [`kerasformers/whisper_large_v2`](https://huggingface.co/kerasformers/whisper_large_v2) | 1.55B | | `whisper_large_v3` | [`kerasformers/whisper_large_v3`](https://huggingface.co/kerasformers/whisper_large_v3) | 128 mel bins | | `whisper_large_v3_turbo` | [`kerasformers/whisper_large_v3_turbo`](https://huggingface.co/kerasformers/whisper_large_v3_turbo) | 4 decoder layers | ## Tips - Set `KERAS_BACKEND` **before** importing Keras / kerasformers. - Prefer `WhisperProcessor.from_weights(...)` so mel bins match the variant (v3 uses 128). - Clips are padded to a 30 s window; chunk longer audio yourself. - See [Whisper docs](https://imvision12.github.io/KerasFormers/whisper/) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/). - Community / upstream safetensors still work via the `hf:` prefix, e.g. `WhisperConditionalGenerate.from_weights("hf:openai/whisper-large-v3")`. ## Special Thanks A huge thank you to the OpenAI Whisper authors for creating and releasing these models. License: Apache 2.0.