V2 of Phreak87/moonshine-tiny-de-onnx. Same model weights as dattazigzag/moonshine-tiny-de, re-exported with optimum.
Why this version exists: V1's HTML had a custom 50-line decoder loop because optimum's merged-decoder export has a broken then_branch (cache=True path uses past_key_values.X.encoder.* directly as cross-attention K/V, which are zero on step1, producing wrong first token). V2 fixes the merged decoder at the ONNX level so the standard pipeline('automatic-speech-recognition', modelId) call works without any model-specific decoder hack in the HTML.
The fix:
Without the bake, incremental decoding on tiny produces "g g g g g g..." (repetition loop).
See v2/fix_then_branch.py for the patch script.
Moonshine_DE_V2.html in Phreak87/moonshine-base_V2 is the matching V2 HTML. It supports both tiny and base via dropdown.
Validated against V1's full-seq-each-step decoding on test-de.mp3:
V2 greedy: guten morgen das ist ein thes der lokalen sprach erkennung mit mundschiene
V1 greedy: guten morgen das ist ein thes der lokalen sprach erkennung mit mundschiene
Both paths produce identical ids, byte-for-byte.
import { pipeline, AutoTokenizer } from 'https://cdn.jsdelivr.net/npm/@huggingface/[email protected]/dist/transformers.min.js';
const pipe = await pipeline('automatic-speech-recognition', 'Phreak87/moonshine-tiny_V2', { dtype: 'fp32' });
pipe.processor.components.tokenizer = await AutoTokenizer.from_pretrained('Phreak87/moonshine-tiny_V2');
const result = await pipe(audio, {}); // audio: Float32Array @ 16 kHz
console.log(result.text);
onnx/decoder_model_merged.onnx 115 MiBonnx/encoder_model.onnx 30 MiB