Instructions to use zeromodels/moonshine_tiny with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ZeroModels
How to use zeromodels/moonshine_tiny with ZeroModels:
# pip install -U zeromodels # ZeroModels is pure Keras 3, so pick a backend: "jax", "torch" or "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" from zeromodels import AutoZModel # AutoZModel reads the repo's model_type and loads the matching class. # For a task head use the matching loader, e.g. AutoZMImageClassify / AutoZMDetect / # AutoZMSemanticSegment / AutoZMTextGenerate (see zeromodels.auto). model = AutoZModel.from_weights("zeromodels/moonshine_tiny") - Keras
How to use zeromodels/moonshine_tiny with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://zeromodels/moonshine_tiny") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from zeromodels/moonshine_tiny: direct link, hf CLI and curl.
- Browser
- Download file 3.28 kB
-
https://huggingface.co/zeromodels/moonshine_tiny/resolve/main/README.md
- Command line
-
hf download hf://zeromodels/moonshine_tiny/README.md
-
curl -L -o README.md https://huggingface.co/zeromodels/moonshine_tiny/resolve/main/README.md
3.28 kB
| pipeline_tag: automatic-speech-recognition | |
| license: mit | |
| base_model: UsefulSensors/moonshine-tiny | |
| library_name: zeromodels | |
| tags: | |
| - keras | |
| - zeromodels | |
| - moonshine | |
| - automatic-speech-recognition | |
| - audio | |
| - arxiv:2410.15608 | |
| - pytorch | |
| - jax | |
| - tf | |
| ## ***See [our collection](https://huggingface.co/collections/zeromodels/moonshine-6a8eaf317c682a7009c68b2c) for all versions of Moonshine.*** | |
| # Run Moonshine with Keras 3: JAX, PyTorch, or TensorFlow | |
| [](https://github.com/IMvision12/ZeroModels) [](https://imvision12.github.io/ZeroModels/moonshine/) [](https://huggingface.co/collections/zeromodels/moonshine-6a8eaf317c682a7009c68b2c) | |
| # zeromodels/moonshine_tiny | |
| 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) | |
| 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. | |
| For more details on the model, please go to the upstream [model card](https://huggingface.co/UsefulSensors/moonshine-tiny). | |
| Pure-**Keras 3** conversion of [`UsefulSensors/moonshine-tiny`](https://huggingface.co/UsefulSensors/moonshine-tiny) for [zeromodels](https://github.com/IMvision12/ZeroModels). One implementation runs unmodified on **TensorFlow / Torch / JAX**. | |
| This is an **ASR** checkpoint (`MoonshineConditionalGenerate`). | |
| ## ✨ Quick start | |
| ```python | |
| import os | |
| os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow" | |
| import soundfile as sf | |
| from zeromodels.models.moonshine import ( | |
| MoonshineProcessor, | |
| MoonshineConditionalGenerate, | |
| ) | |
| model = MoonshineConditionalGenerate.from_weights("zeromodels/moonshine_tiny") | |
| processor = MoonshineProcessor.from_weights("zeromodels/moonshine_tiny") | |
| audio, sr = sf.read("your_audio.wav", dtype="float32") # 16 kHz mono | |
| # Cost scales with clip length: no fixed 30 s pad like Whisper. | |
| text = model.generate(audio, processor) | |
| print(repr(text[0])) | |
| ``` | |
| Load any Moonshine variant the same way with `from_weights("zeromodels/<variant>")`: | |
| | Variant | Hub | | |
| |---|---| | |
| | `moonshine_tiny` | [`zeromodels/moonshine_tiny`](https://huggingface.co/zeromodels/moonshine_tiny) | | |
| | `moonshine_base` | [`zeromodels/moonshine_base`](https://huggingface.co/zeromodels/moonshine_base) | | |
| ## Tips | |
| - Set `KERAS_BACKEND` **before** importing Keras / zeromodels. | |
| - Prefer `MoonshineProcessor.from_weights(...)` so feature extraction matches. | |
| - English-only; pass a list of waveforms to batch. | |
| - See [Moonshine docs](https://imvision12.github.io/ZeroModels/moonshine/) and [Loading Weights](https://imvision12.github.io/ZeroModels/loading_weights/). | |
| - Community / upstream safetensors still work via the `hf:` prefix, e.g. `MoonshineConditionalGenerate.from_weights("hf:UsefulSensors/moonshine-tiny")`. | |
| ## Special Thanks | |
| A huge thank you to the Useful Sensors Moonshine authors for creating and releasing these models. | |
| License: MIT. | |