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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model: UsefulSensors/moonshine-streaming-small
|
| 4 |
+
base_model_relation: quantized
|
| 5 |
+
library_name: transcribe.cpp
|
| 6 |
+
pipeline_tag: automatic-speech-recognition
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
tags:
|
| 10 |
+
- gguf
|
| 11 |
+
- transcribe.cpp
|
| 12 |
+
- asr
|
| 13 |
+
- speech-to-text
|
| 14 |
+
- moonshine
|
| 15 |
+
- moonshine-streaming
|
| 16 |
+
- useful-sensors
|
| 17 |
+
- encoder-decoder
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# moonshine-streaming-small — transcribe.cpp GGUF
|
| 21 |
+
|
| 22 |
+
GGUF conversions of [UsefulSensors/moonshine-streaming-small](https://huggingface.co/UsefulSensors/moonshine-streaming-small) for use
|
| 23 |
+
with [transcribe.cpp](https://github.com/handy-computer/transcribe.cpp).
|
| 24 |
+
|
| 25 |
+
Ported from upstream commit
|
| 26 |
+
[2c03650](https://huggingface.co/UsefulSensors/moonshine-streaming-small/commit/2c03650),
|
| 27 |
+
pinned 2026-05-06.
|
| 28 |
+
Validated against the HF Transformers v5.7.0 reference at transcribe.cpp commit
|
| 29 |
+
[0d312ce](https://github.com/handy-computer/transcribe.cpp/tree/0d312ce)
|
| 30 |
+
on 2026-05-06.
|
| 31 |
+
|
| 32 |
+
Offline English speech-to-text. A 123M-parameter encoder-decoder ASR model
|
| 33 |
+
designed for streaming use (ergodic encoder + sliding-window attention,
|
| 34 |
+
50 Hz time-domain frontend). Same family as moonshine-streaming-tiny;
|
| 35 |
+
deeper encoder/decoder (10 / 10 layers) and wider hidden dims (encoder 620 /
|
| 36 |
+
decoder 512). Takes a 16 kHz mono WAV and produces a transcript.
|
| 37 |
+
No translation, no multilingual capability, no timestamps.
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
## Downloads
|
| 41 |
+
|
| 42 |
+
| Quantization | Download | Size | WER (LibriSpeech test-clean) |
|
| 43 |
+
| --- | --- | ---: | ---: |
|
| 44 |
+
| F32 | [moonshine-streaming-small-F32.gguf](https://huggingface.co/handy-computer/moonshine-streaming-small-gguf/resolve/main/moonshine-streaming-small-F32.gguf) | 536 MB | 2.53% |
|
| 45 |
+
| F16 | [moonshine-streaming-small-F16.gguf](https://huggingface.co/handy-computer/moonshine-streaming-small-gguf/resolve/main/moonshine-streaming-small-F16.gguf) | 269 MB | 2.53% |
|
| 46 |
+
| Q8_0 | [moonshine-streaming-small-Q8_0.gguf](https://huggingface.co/handy-computer/moonshine-streaming-small-gguf/resolve/main/moonshine-streaming-small-Q8_0.gguf) | 189 MB | 2.54% |
|
| 47 |
+
|
| 48 |
+
WER measured on the full LibriSpeech test-clean split (2620 utterances)
|
| 49 |
+
with greedy decoding (`num_beams=1`, `do_sample=False`). F32 reference
|
| 50 |
+
baseline: 2.53%. Useful Sensors' self-reported number on this split is
|
| 51 |
+
2.49% from the Open ASR Leaderboard table; the +0.04pp residual matches
|
| 52 |
+
the same scoring / text-normalization difference seen on the tiny variant
|
| 53 |
+
where we cross-checked against the HF Transformers reference (4.52% on
|
| 54 |
+
the same manifest, 99.6% identical hypotheses to our F32) and confirmed
|
| 55 |
+
it is not a numerical drift in the port. Q6_K / Q5_K_M / Q4_K_M GGUFs
|
| 56 |
+
are not currently shipped for this variant.
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
## Usage
|
| 60 |
+
|
| 61 |
+
Build transcribe.cpp from source:
|
| 62 |
+
|
| 63 |
+
```bash
|
| 64 |
+
git clone git@github.com:handy-computer/transcribe.cpp.git
|
| 65 |
+
cd transcribe.cpp
|
| 66 |
+
cmake -B build && cmake --build build
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
Run on a 16 kHz mono WAV:
|
| 70 |
+
|
| 71 |
+
```bash
|
| 72 |
+
build/bin/transcribe-cli \
|
| 73 |
+
-m moonshine-streaming-small-Q8_0.gguf \
|
| 74 |
+
input.wav
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
If your audio isn't already 16 kHz mono WAV, convert it first:
|
| 78 |
+
|
| 79 |
+
```bash
|
| 80 |
+
ffmpeg -i input.mp3 -ar 16000 -ac 1 output.wav
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
See the [transcribe.cpp model page](https://github.com/handy-computer/transcribe.cpp/blob/main/docs/models/moonshine-streaming-small.md) for performance
|
| 84 |
+
numbers, numerical validation, and reproduction steps.
|
| 85 |
+
|
| 86 |
+
## License
|
| 87 |
+
|
| 88 |
+
Inherited from the base model: **MIT**. See the
|
| 89 |
+
[upstream model card](https://huggingface.co/UsefulSensors/moonshine-streaming-small) for full terms.
|
| 90 |
+
|
| 91 |
+
---
|
| 92 |
+
|
| 93 |
+
## Original Model Card
|
| 94 |
+
|
| 95 |
+
> The section below is reproduced from
|
| 96 |
+
> [UsefulSensors/moonshine-streaming-small](https://huggingface.co/UsefulSensors/moonshine-streaming-small) at commit
|
| 97 |
+
> `2c03650` for offline reference. The upstream card is the
|
| 98 |
+
> authoritative source.
|
| 99 |
+
|
| 100 |
+
# Moonshine Streaming
|
| 101 |
+
|
| 102 |
+
[[Paper]](https://download.moonshine.ai/docs/moonshine_streaming_paper.pdf)
|
| 103 |
+
|
| 104 |
+
This is the model card for the Moonshine Streaming automatic speech
|
| 105 |
+
recognition (ASR) models trained and released by Useful Sensors. Moonshine Streaming
|
| 106 |
+
pairs a lightweight 50~Hz audio frontend with a sliding-window Transformer
|
| 107 |
+
encoder to deliver low-latency streaming ASR on edge-class hardware. The encoder
|
| 108 |
+
uses bounded local attention and no positional embeddings (an "ergodic"
|
| 109 |
+
encoder), while an adapter injects positional information before a standard
|
| 110 |
+
autoregressive decoder.
|
| 111 |
+
|
| 112 |
+
This model card follows the recommendations from Model Cards for Model Reporting
|
| 113 |
+
(Mitchell et al.). See the paper draft in this repository for full details.
|
| 114 |
+
|
| 115 |
+
## Usage
|
| 116 |
+
|
| 117 |
+
Moonshine Streaming is supported in Hugging Face Transformers. The following example
|
| 118 |
+
matches the standard seq2seq ASR API and uses the streaming model checkpoint:
|
| 119 |
+
|
| 120 |
+
```bash
|
| 121 |
+
pip install --upgrade pip
|
| 122 |
+
pip install --upgrade git+https://github.com/huggingface/transformers.git#egg=transformers datasets[audio]
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
```python
|
| 126 |
+
from transformers import MoonshineStreamingForConditionalGeneration, AutoProcessor
|
| 127 |
+
from datasets import load_dataset, Audio
|
| 128 |
+
import torch
|
| 129 |
+
|
| 130 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 131 |
+
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
| 132 |
+
|
| 133 |
+
model = MoonshineStreamingForConditionalGeneration.from_pretrained(
|
| 134 |
+
"usefulsensors/moonshine-streaming-small"
|
| 135 |
+
).to(device).to(torch_dtype)
|
| 136 |
+
processor = AutoProcessor.from_pretrained("usefulsensors/moonshine-streaming-small")
|
| 137 |
+
|
| 138 |
+
dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
|
| 139 |
+
dataset = dataset.cast_column("audio", Audio(processor.feature_extractor.sampling_rate))
|
| 140 |
+
sample = dataset[0]["audio"]
|
| 141 |
+
|
| 142 |
+
inputs = processor(
|
| 143 |
+
sample["array"],
|
| 144 |
+
return_tensors="pt",
|
| 145 |
+
sampling_rate=processor.feature_extractor.sampling_rate,
|
| 146 |
+
)
|
| 147 |
+
inputs = inputs.to(device, torch_dtype)
|
| 148 |
+
|
| 149 |
+
# Limit max output length to avoid hallucination loops.
|
| 150 |
+
token_limit_factor = 6.5 / processor.feature_extractor.sampling_rate
|
| 151 |
+
seq_lens = inputs.attention_mask.sum(dim=-1)
|
| 152 |
+
max_length = int((seq_lens * token_limit_factor).max().item())
|
| 153 |
+
|
| 154 |
+
generated_ids = model.generate(**inputs, max_length=max_length)
|
| 155 |
+
print(processor.decode(generated_ids[0], skip_special_tokens=True))
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
Note: the current Transformers code path does not yet implement fully efficient
|
| 159 |
+
streaming for these models. It uses the flash-attention backend's sliding-window
|
| 160 |
+
attention when available.
|
| 161 |
+
|
| 162 |
+
## Model Details
|
| 163 |
+
|
| 164 |
+
### Model type
|
| 165 |
+
|
| 166 |
+
Sequence-to-sequence ASR model with a streaming, sliding-window Transformer
|
| 167 |
+
encoder and an autoregressive Transformer decoder.
|
| 168 |
+
|
| 169 |
+
### Supported languages
|
| 170 |
+
|
| 171 |
+
English (trained and evaluated on English datasets).
|
| 172 |
+
|
| 173 |
+
### Model sizes
|
| 174 |
+
|
| 175 |
+
| Size | Parameters | Encoder / Decoder layers | Encoder dim | Decoder dim |
|
| 176 |
+
|:-----:|:----------:|:------------------------:|:-----------:|:-----------:|
|
| 177 |
+
| Tiny | 34M | 6 / 6 | 320 | 320 |
|
| 178 |
+
| Small | 123M | 10 / 10 | 620 | 512 |
|
| 179 |
+
| Medium| 245M | 14 / 14 | 768 | 640 |
|
| 180 |
+
|
| 181 |
+
### Architecture summary
|
| 182 |
+
|
| 183 |
+
- Audio frontend: 50~Hz features using simple time-domain operations, CMVN, and
|
| 184 |
+
two causal stride-2 convolutions.
|
| 185 |
+
- Encoder: sliding-window self-attention with no positional embeddings (ergodic
|
| 186 |
+
encoder). Windowing uses $(16,4)$ for the first two and last two layers and
|
| 187 |
+
$(16,0)$ for intermediate layers, giving an 80~ms lookahead in the lookahead
|
| 188 |
+
layers.
|
| 189 |
+
- Adapter: adds learned positional embeddings and aligns dimensions before the
|
| 190 |
+
decoder.
|
| 191 |
+
- Decoder: causal Transformer with RoPE, autoregressively generating text.
|
| 192 |
+
|
| 193 |
+
## Model Use
|
| 194 |
+
|
| 195 |
+
### Intended use
|
| 196 |
+
|
| 197 |
+
These models are intended for low-latency, on-device English speech
|
| 198 |
+
transcription on memory- and compute-constrained platforms (roughly
|
| 199 |
+
0.1--1~TOPS and sub-1~GB memory budgets). Typical applications include live
|
| 200 |
+
captioning, voice commands, and real-time transcription.
|
| 201 |
+
|
| 202 |
+
### Out-of-scope use
|
| 203 |
+
|
| 204 |
+
These models are not intended for non-consensual surveillance, speaker
|
| 205 |
+
identification, or high-stakes decision-making contexts. They have not been
|
| 206 |
+
robustly evaluated for tasks outside English ASR.
|
| 207 |
+
|
| 208 |
+
## Training Data
|
| 209 |
+
|
| 210 |
+
Moonshine Streaming was trained on roughly 300K hours of speech data. This includes the
|
| 211 |
+
original Moonshine training sources (about 200K hours of public web data and
|
| 212 |
+
open datasets) plus an additional 100K hours of internally prepared speech
|
| 213 |
+
data. See the paper for details and dataset sources.
|
| 214 |
+
|
| 215 |
+
## Performance and Limitations
|
| 216 |
+
|
| 217 |
+
### Open ASR benchmark results (WER %)
|
| 218 |
+
|
| 219 |
+
| Dataset | Tiny (34M) | Small (123M) | Medium (245M) |
|
| 220 |
+
|:----------------------|----------:|-------------:|--------------:|
|
| 221 |
+
| AMI | 19.03 | 12.54 | 10.68 |
|
| 222 |
+
| Earnings-22 | 20.27 | 13.53 | 11.90 |
|
| 223 |
+
| GigaSpeech | 13.90 | 10.41 | 9.46 |
|
| 224 |
+
| LibriSpeech (clean) | 4.49 | 2.49 | 2.08 |
|
| 225 |
+
| LibriSpeech (other) | 12.09 | 6.78 | 5.00 |
|
| 226 |
+
| SPGISpeech | 6.16 | 3.19 | 2.58 |
|
| 227 |
+
| TED-LIUM | 6.12 | 3.77 | 2.99 |
|
| 228 |
+
| VoxPopuli | 14.02 | 9.98 | 8.54 |
|
| 229 |
+
| **Average** | **12.01** | **7.84** | **6.65** |
|
| 230 |
+
|
| 231 |
+
### Known limitations
|
| 232 |
+
|
| 233 |
+
- The decoder is autoregressive, so full-output latency grows with transcript
|
| 234 |
+
length even when TTFT is low.
|
| 235 |
+
- The Transformers implementation does not yet perform fully efficient
|
| 236 |
+
streaming; it relies on the flash-attention backend for sliding-window
|
| 237 |
+
attention.
|
| 238 |
+
- Like other seq2seq ASR models, Moonshine Streaming can hallucinate words that are not
|
| 239 |
+
present in the audio, and may repeat phrases, especially on short or noisy
|
| 240 |
+
segments.
|
| 241 |
+
|
| 242 |
+
## Broader Implications
|
| 243 |
+
|
| 244 |
+
Moonshine Streaming enables low-cost, low-latency transcription, which benefits
|
| 245 |
+
accessibility and user interaction on edge devices. At the same time, ASR
|
| 246 |
+
capabilities can be misused for surveillance or other harmful purposes. Users
|
| 247 |
+
should consider consent, privacy, and domain-specific evaluation before
|
| 248 |
+
deployment.
|
| 249 |
+
|
| 250 |
+
## Citation
|
| 251 |
+
|
| 252 |
+
**TBD**
|