Views
No views yet
fidoriel/moonshine-base-de, a 62M-parameter German speech-recognition model. It is the base variant of Moonshine, the tiny ASR family from Useful Sensors that is purpose-built for on-device inference.onnx/encoder_model.onnx (~77 MB)
onnx/decoder_model_onnx (~210 MB, no-cache variant)
onnx/decoder_model_merged.onnx (~211 MB, with past_key_values + use_cache_branch If-node)
onnx/decoder_with_past_model.onnx (~200 MB, cache-only variant)
config.json
preprocessor_config.json
generation_config.json
tokenizer.json + tokenizer_config.json + special_tokens_map.jsonuse_cache_branch boolean input that switches between
two subgraphs. We set this to False in the shipped decoder_model_merged.onnx
(constant initializer), so the If-node always picks the no-cache branch. See
Known issues below for why.scripts/:scripts/export_no_attn.py — runs optimum.exporters.onnx on the
fidoriel/moonshine-base-de PyTorch snapshot, after monkey-patching
MoonshineOnnxConfig.inputs to omit the attention_mask input. With
single-batch inference and no padding, the attention mask is a no-op; dropping
it simplifies the exported graph considerably.scripts/patch_decoder.py — post-processes the merged decoder: removes
use_cache_branch from the inputs and replaces it with a constant
initializer of value False. This forces the no-cache branch which is the
only one that produces correct tokens in our pipeline.1python -m optimum.exporters.onnx \
2 -m fidoriel/moonshine-base-de \
3 --task automatic-speech-recognition-with-past \
4 --library-name transformers \
5 --device cpu --dtype fp32 --opset 14 \
6 out_dir
7python scripts/patch_decoder.py out_dir/decoder_model_merged.onnxDockerfile (python scripts/export_no_attn.py).moonshine-de.html is a single-file demo that runs the model entirely in the
browser using Transformers.js. To run it locally:1python scripts/server_threaded.py 8765
2# open http://localhost:8765/moonshine-de.htmlpython -m http.server is
single-threaded and Transformers.js opens several concurrent requests (e.g.
for cache lookup + actual fetch) which trips ConnectionResetError.guten morgen, das ist ein test der lokalen spracherkennung mit moonshine
Expected transcription: a clean German sentence starting with Guten Morgen, das ist ein Test der lokalen Spracherkennung ....use_cache_branch is hard-coded to FalseIf-node that branches between
the cache and no-cache decoder subgraphs: the cache branch produces wrong
tokens through the transformers.js + onnxruntime-web combination. Specifically,
the encoder-attention MatMul fails with right operand cannot broadcast on dim 0 once the cached encoder K/V has seq_len > 0.use_cache_branch_const=False in the
shipped decoder_model_merged.onnx. The downside is that every decoder step
recomputes K/V from encoder_hidden_states from scratch — slow but correct.
Typical decode time for a 5-second clip is around 6 seconds on a desktop CPU.moonshine-de.html does not use the standard
transformers.js > pipeline > pipe(audio) path. The standard path goes
through the same If-node cache branch described above and produces
token 1768 '„' instead of the expected token 402 'G'. The HTML
therefore loads the encoder and decoder sessions directly and runs a manual
greedy decode loop, feeding the full token history to the decoder on every
step (no caching). This is the same workaround as the use_cache_branch_const
hack, applied at runtime instead of in the model.If-node bug (could be an optimum export issue with newer
opset, or a transformers.js cache-construction issue).onnx-community/moonshine-base-ONNX export path adapted
for the DE weights to see if it sidesteps the bug.fidoriel/moonshine-base-de model
and the Moonshine base architecture.1@software{moonshine_base_de_onnx,
2 title = {Moonshine Base DE — ONNX},
3 author = {Phreak87},
4 year = {2026},
5 url = {https://huggingface.co/Phreak87/moonshine-base-de-onnx},
6}