Instructions to use zeromodels/whisper_base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasFormers
How to use zeromodels/whisper_base with KerasFormers:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Keras
How to use zeromodels/whisper_base with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://zeromodels/whisper_base") - Notebooks
- Google Colab
- Kaggle
fix readme.md
Browse files
README.md
CHANGED
|
@@ -1,22 +1,83 @@
|
|
| 1 |
---
|
| 2 |
pipeline_tag: automatic-speech-recognition
|
| 3 |
license: apache-2.0
|
|
|
|
| 4 |
library_name: kerasformers
|
| 5 |
tags:
|
| 6 |
- keras
|
| 7 |
- kerasformers
|
| 8 |
- whisper
|
| 9 |
-
-
|
| 10 |
-
-
|
|
|
|
|
|
|
| 11 |
- pytorch
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
|
| 18 |
```python
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
pipeline_tag: automatic-speech-recognition
|
| 3 |
license: apache-2.0
|
| 4 |
+
base_model: openai/whisper-base
|
| 5 |
library_name: kerasformers
|
| 6 |
tags:
|
| 7 |
- keras
|
| 8 |
- kerasformers
|
| 9 |
- whisper
|
| 10 |
+
- automatic-speech-recognition
|
| 11 |
+
- audio
|
| 12 |
+
- multilingual
|
| 13 |
+
- arxiv:2212.04356
|
| 14 |
- pytorch
|
| 15 |
+
- jax
|
| 16 |
+
- tf
|
| 17 |
---
|
| 18 |
|
| 19 |
+
## ***See [our collection](https://huggingface.co/collections/kerasformers/whisper-6a6ac856710a03d7d2e207b6) for all versions of Whisper.***
|
| 20 |
+
|
| 21 |
+
# Run Whisper with Keras 3: JAX, PyTorch, or TensorFlow
|
| 22 |
+
|
| 23 |
+
[](https://github.com/IMvision12/KerasFormers) [](https://imvision12.github.io/KerasFormers/whisper/) [](https://huggingface.co/collections/kerasformers/whisper-6a6ac856710a03d7d2e207b6)
|
| 24 |
+
|
| 25 |
+
# kerasformers/whisper_base
|
| 26 |
+
|
| 27 |
+
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)
|
| 28 |
+
|
| 29 |
+
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.
|
| 30 |
+
|
| 31 |
+
For more details on the model, please go to the upstream [model card](https://huggingface.co/openai/whisper-base).
|
| 32 |
+
|
| 33 |
+
Pure-**Keras 3** conversion of [`openai/whisper-base`](https://huggingface.co/openai/whisper-base) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**.
|
| 34 |
|
| 35 |
+
This is an **ASR** checkpoint (`WhisperSpeechToText`, 74M).
|
| 36 |
+
|
| 37 |
+
## ✨ Quick start
|
| 38 |
|
| 39 |
```python
|
| 40 |
+
import os
|
| 41 |
+
os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
|
| 42 |
+
|
| 43 |
+
import soundfile as sf
|
| 44 |
+
from kerasformers.models.whisper import (
|
| 45 |
+
WhisperProcessor,
|
| 46 |
+
WhisperSpeechToText,
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
model = WhisperSpeechToText.from_weights("kerasformers/whisper_base")
|
| 50 |
+
processor = WhisperProcessor.from_weights("kerasformers/whisper_base")
|
| 51 |
+
|
| 52 |
+
audio, sr = sf.read("your_audio.wav", dtype="float32") # 16 kHz mono
|
| 53 |
+
# task="transcribe" keeps the source language; "translate" -> English.
|
| 54 |
+
text = model.generate(audio, processor, language="en", task="transcribe")
|
| 55 |
+
print(repr(text[0]))
|
| 56 |
```
|
| 57 |
+
|
| 58 |
+
Load any Whisper variant the same way with `from_weights("kerasformers/<variant>")`:
|
| 59 |
+
|
| 60 |
+
| Variant | Hub | Notes |
|
| 61 |
+
|---|---|---|
|
| 62 |
+
| `whisper_tiny` | [`kerasformers/whisper_tiny`](https://huggingface.co/kerasformers/whisper_tiny) | 39M |
|
| 63 |
+
| `whisper_base` | [`kerasformers/whisper_base`](https://huggingface.co/kerasformers/whisper_base) | 74M |
|
| 64 |
+
| `whisper_small` | [`kerasformers/whisper_small`](https://huggingface.co/kerasformers/whisper_small) | 244M |
|
| 65 |
+
| `whisper_medium` | [`kerasformers/whisper_medium`](https://huggingface.co/kerasformers/whisper_medium) | 769M |
|
| 66 |
+
| `whisper_large` | [`kerasformers/whisper_large`](https://huggingface.co/kerasformers/whisper_large) | 1.55B |
|
| 67 |
+
| `whisper_large_v2` | [`kerasformers/whisper_large_v2`](https://huggingface.co/kerasformers/whisper_large_v2) | 1.55B |
|
| 68 |
+
| `whisper_large_v3` | [`kerasformers/whisper_large_v3`](https://huggingface.co/kerasformers/whisper_large_v3) | 128 mel bins |
|
| 69 |
+
| `whisper_large_v3_turbo` | [`kerasformers/whisper_large_v3_turbo`](https://huggingface.co/kerasformers/whisper_large_v3_turbo) | 4 decoder layers |
|
| 70 |
+
|
| 71 |
+
## Tips
|
| 72 |
+
|
| 73 |
+
- Set `KERAS_BACKEND` **before** importing Keras / kerasformers.
|
| 74 |
+
- Prefer `WhisperProcessor.from_weights(...)` so mel bins match the variant (v3 uses 128).
|
| 75 |
+
- Clips are padded to a 30 s window; chunk longer audio yourself.
|
| 76 |
+
- See [Whisper docs](https://imvision12.github.io/KerasFormers/whisper/) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).
|
| 77 |
+
- Community / upstream safetensors still work via the `hf:` prefix, e.g. `WhisperSpeechToText.from_weights("hf:openai/whisper-base")`.
|
| 78 |
+
|
| 79 |
+
## Special Thanks
|
| 80 |
+
|
| 81 |
+
A huge thank you to the OpenAI Whisper authors for creating and releasing these models.
|
| 82 |
+
|
| 83 |
+
License: Apache 2.0.
|