Instructions to use zeromodels/moonshine_base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasFormers
How to use zeromodels/moonshine_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/moonshine_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/moonshine_base") - Notebooks
- Google Colab
- Kaggle
fix readme.md
Browse files
README.md
CHANGED
|
@@ -1,22 +1,76 @@
|
|
| 1 |
---
|
| 2 |
pipeline_tag: automatic-speech-recognition
|
| 3 |
license: mit
|
|
|
|
| 4 |
library_name: kerasformers
|
| 5 |
tags:
|
| 6 |
- keras
|
| 7 |
- kerasformers
|
| 8 |
- moonshine
|
| 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: mit
|
| 4 |
+
base_model: UsefulSensors/moonshine-base
|
| 5 |
library_name: kerasformers
|
| 6 |
tags:
|
| 7 |
- keras
|
| 8 |
- kerasformers
|
| 9 |
- moonshine
|
| 10 |
+
- automatic-speech-recognition
|
| 11 |
+
- audio
|
| 12 |
+
- arxiv:2410.15608
|
| 13 |
- pytorch
|
| 14 |
+
- jax
|
| 15 |
+
- tf
|
| 16 |
---
|
| 17 |
|
| 18 |
+
## ***See [our collection](https://huggingface.co/collections/kerasformers/moonshine-6a6acc6dae5ff619b873d6c9) for all versions of Moonshine.***
|
| 19 |
+
|
| 20 |
+
# Run Moonshine with Keras 3: JAX, PyTorch, or TensorFlow
|
| 21 |
+
|
| 22 |
+
[](https://github.com/IMvision12/KerasFormers) [](https://imvision12.github.io/KerasFormers/moonshine/) [](https://huggingface.co/collections/kerasformers/moonshine-6a6acc6dae5ff619b873d6c9)
|
| 23 |
+
|
| 24 |
+
# kerasformers/moonshine_base
|
| 25 |
+
|
| 26 |
+
Paper: [Moonshine: Speech Recognition for Live Transcription and Voice Commands (arXiv:2410.15608)](https://arxiv.org/abs/2410.15608) · [HF Papers](https://huggingface.co/papers/2410.15608)
|
| 27 |
+
|
| 28 |
+
Moonshine is an English ASR encoder-decoder built for **short / live** audio: the encoder sees the raw waveform length you pass in (no Whisper-style 30 s pad), so short commands stay cheap. Output is cased and punctuated.
|
| 29 |
+
|
| 30 |
+
For more details on the model, please go to the upstream [model card](https://huggingface.co/UsefulSensors/moonshine-base).
|
| 31 |
+
|
| 32 |
+
Pure-**Keras 3** conversion of [`UsefulSensors/moonshine-base`](https://huggingface.co/UsefulSensors/moonshine-base) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**.
|
| 33 |
|
| 34 |
+
This is an **ASR** checkpoint (`MoonshineSpeechToText`).
|
| 35 |
+
|
| 36 |
+
## ✨ Quick start
|
| 37 |
|
| 38 |
```python
|
| 39 |
+
import os
|
| 40 |
+
os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
|
| 41 |
+
|
| 42 |
+
import soundfile as sf
|
| 43 |
+
from kerasformers.models.moonshine import (
|
| 44 |
+
MoonshineProcessor,
|
| 45 |
+
MoonshineSpeechToText,
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
model = MoonshineSpeechToText.from_weights("kerasformers/moonshine_base")
|
| 49 |
+
processor = MoonshineProcessor.from_weights("kerasformers/moonshine_base")
|
| 50 |
+
|
| 51 |
+
audio, sr = sf.read("your_audio.wav", dtype="float32") # 16 kHz mono
|
| 52 |
+
# Cost scales with clip length: no fixed 30 s pad like Whisper.
|
| 53 |
+
text = model.generate(audio, processor)
|
| 54 |
+
print(repr(text[0]))
|
| 55 |
```
|
| 56 |
+
|
| 57 |
+
Load any Moonshine variant the same way with `from_weights("kerasformers/<variant>")`:
|
| 58 |
+
|
| 59 |
+
| Variant | Hub |
|
| 60 |
+
|---|---|
|
| 61 |
+
| `moonshine_tiny` | [`kerasformers/moonshine_tiny`](https://huggingface.co/kerasformers/moonshine_tiny) |
|
| 62 |
+
| `moonshine_base` | [`kerasformers/moonshine_base`](https://huggingface.co/kerasformers/moonshine_base) |
|
| 63 |
+
|
| 64 |
+
## Tips
|
| 65 |
+
|
| 66 |
+
- Set `KERAS_BACKEND` **before** importing Keras / kerasformers.
|
| 67 |
+
- Prefer `MoonshineProcessor.from_weights(...)` so feature extraction matches.
|
| 68 |
+
- English-only; pass a list of waveforms to batch.
|
| 69 |
+
- See [Moonshine docs](https://imvision12.github.io/KerasFormers/moonshine/) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).
|
| 70 |
+
- Community / upstream safetensors still work via the `hf:` prefix, e.g. `MoonshineSpeechToText.from_weights("hf:UsefulSensors/moonshine-base")`.
|
| 71 |
+
|
| 72 |
+
## Special Thanks
|
| 73 |
+
|
| 74 |
+
A huge thank you to the Useful Sensors Moonshine authors for creating and releasing these models.
|
| 75 |
+
|
| 76 |
+
License: MIT.
|