You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ed0319d
Browse filesBrowse the repository at this point in the historyBrowse files
## Summary
- add native `moonshine` support for `moonshine-ai/moonshine-tiny`
without aliasing it to Whisper
- implement the raw-waveform convolution encoder, GroupNorm, partial
interleaved RoPE, bias-free encoder/decoder attention, gated decoder
MLP, cross-attention masking, tied output projection, and cached
decoding
- generalize `SpeechToTextTask` while preserving Whisper, including
correct 80/128 `num_mel_bins` input-channel handling
- export tokenizer, `audio_processor.json`, and composite onnx-genai
metadata
- add L1 graph/config/alignment, L2 real-config, L3
synthetic/real-weight parity, and real-audio L4/L5 goldens
## Updated from main
Rebased onto `origin/main` at
`1e6f61f42b0ddbc90f60bccbf00eff26cd484256`, including main's fused Swish
support. Moonshine now uses the public `SiLU` component and emits one
ONNX `Swish` op per decoder layer instead of `Sigmoid + Mul`.
## Fusion and optimized-graph audit
Audited fp16 opset-24 graphs with ONNX Runtime GPU 1.28.0 on CUDA EP;
`CUDAExecutionProvider` was asserted first for encoder and decoder.
| Graph | Mobius nodes | ORT-optimized nodes | Key optimized ops |
Identity | Unused initializers | Memcpy |
|---|---:|---:|---|---:|---:|---:|
| encoder | 115 | 131 | 6 Attention, 6 BiasGelu, 12
SkipLayerNormalization | 0 | 0 | 0 |
| decoder | 151 | 151 | 12 Attention, 6 QuickGelu(alpha=1.0), 18
SkipLayerNormalization | 0 | 0 | 0 |
Additional structural evidence:
- Mobius decoder graph: 6 `Swish`, 0 `Sigmoid`
- ORT folds each Swish to `QuickGelu(alpha=1.0)`
- encoder GroupNormalization is optimized without CPU fallback
- only one encoder transpose remains, required for Conv1d `[B,C,T]` to
transformer `[B,T,C]`
- no protobuf construction APIs
- no opset-lowering workaround needed on ORT 1.28
The standard ONNX `Attention` op is intentional: encoder and
cross-attention require explicit padding bias, which contrib GQA
rejects, and Moonshine's head dimension 36 is not XQA-eligible.
## Validation
### CPU and CUDA parity
Environment: NVIDIA RTX A1000, driver 573.44, CUDA 12.8, ONNX Runtime
GPU 1.28.0.
Real `652-129742-0006.flac`, fp32:
| Boundary | Max abs diff | Mean abs diff | Result |
|---|---:|---:|---|
| encoder hidden states | 0.0045447 | 0.0001437 | finite; masks exact |
| decoder prefill logits | 0.0098586 | 0.0011758 | finite; identical
argmax 29892 |
| greedy transcription | exact | exact | CPU == CUDA == 32-token golden
|
### Dtype coverage
- fp16 CUDA: finite encoder/decoder state and exact 32/32 fp32-golden
transcription tokens
- bf16 CUDA: finite state and exact Hugging Face bf16 CUDA generation
tokens; bf16 output differs from fp32 at the expected near-tie prefix
### Test commands/results
- `python -m pytest tests/build_graph_test.py -k "moonshine or whisper"
-q`: 17 passed
- `python -m pytest tests/moonshine_integration_test.py -q`: 5 passed
- speech config/alignment/parity selection: 18 passed
- CUDA `tests/e2e_golden_test.py -m "golden or generation" -k
moonshine`: 2 passed
- fusion/task/export selection: 13 passed
- YAML schema + model coverage: 945 passed, 215 skipped
- `lintrunner -a`: no lint issues
- automated review findings resolved, including explicit Whisper 128-mel
config/graph regression coverage
## Checklist / waivers
- [x] L1 graph construction and weight alignment
- [x] L2 real Hugging Face config build
- [x] L3 synthetic and real-weight encoder/decoder/cache parity
- [x] L4 real-audio logits golden on CPU and CUDA
- [x] L5 deterministic transcription golden on CPU and CUDA
- [x] fp32/fp16/bf16 CUDA validation
- [x] CLI export, processor/tokenizer wiring, runtime load, and
generation
- [x] ORT 1.28 optimized-graph and fusion audit with zero Memcpy
- [x] full `lintrunner -a`, schema, coverage, and targeted regressions
**Waivers:**
- **Native onnxruntime-genai:** upstream's audio-language runtime is
Whisper-specific and hardcodes 3000 input / 1500 encoder frames plus
Whisper alignment tensors. Moonshine uses variable-length raw waveforms,
so this PR explicitly rejects falsely mapping it to Whisper and
validates onnx-genai metadata plus direct ONNX Runtime CUDA generation
instead.
- **Foundry Local:** not installed in this environment.
- **Olive quantization:** Olive is not installed in this environment.
---------
Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: justinchuby <[email protected]>
Co-authored-by: Copilot App <[email protected]>
0 commit comments