Commit 4597a2a
Add Fun-ASR-Nano and SenseVoiceSmall support (#236)
This pull request introduces support for the SenseVoiceSmall speech
recognition model, including a new ASR example script and shared audio
preprocessing utilities. It also expands the model registry and
configuration to accommodate Fun-ASR and SenseVoiceSmall models, and
exposes new SANM encoder components. The most important changes are
grouped below:
**New ASR Example and Utilities:**
* Added `examples/sensevoice_small.py`, a complete CLI script for
running ONNX-based speech recognition with SenseVoiceSmall, including
CTC decoding, language control, and chunked inference.
* Introduced `examples/asr_utils.py` with reusable audio preprocessing
functions: audio loading, log-mel fbank computation, LFR stacking, CMVN
loading, and full frontend pipeline.
**Model Registry and Configuration Updates:**
* Registered `FunASRForConditionalGeneration` and `SenseVoiceSmallModel`
in the model registry, with proper task types and default HuggingFace
model IDs.
[[1]](diffhunk://#diff-8d5c42d97d876ab3b86d0698ef084e04c65db26af0cea79f0d9dd002cf2ebf69R97)
[[2]](diffhunk://#diff-8d5c42d97d876ab3b86d0698ef084e04c65db26af0cea79f0d9dd002cf2ebf69R121)
[[3]](diffhunk://#diff-8d5c42d97d876ab3b86d0698ef084e04c65db26af0cea79f0d9dd002cf2ebf69R512-R522)
[[4]](diffhunk://#diff-8d5c42d97d876ab3b86d0698ef084e04c65db26af0cea79f0d9dd002cf2ebf69R857-R858)
* Updated the registry to assign the "fun_asr" and "sensevoice_small"
models to the "qwen" organization for fallback detection.
* Extended `AudioConfig` with additional fields for Fun-ASR/SenseVoice
encoder configuration (e.g., `tp_num_blocks`, `adaptor_proj_dim`).
**Component Exposure:**
* Exported SANM encoder components (`SANMAttention`, `SANMEncoderLayer`,
`SANMFFN`) in `mobius.components.__init__` and imported them from the
internal module.
[[1]](diffhunk://#diff-8eacab4d5682bac795dd69c12af6cfb6e6ac9198de7bf37ed06fc748a4682d0cR87-R89)
[[2]](diffhunk://#diff-8eacab4d5682bac795dd69c12af6cfb6e6ac9198de7bf37ed06fc748a4682d0cR247-R251)
---------
Signed-off-by: Justin Chu <justinchu@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent d39b13b commit 4597a2a
25 files changed
Lines changed: 3624 additions & 0 deletions
File tree
- examples
- src/mobius
- components
- models
- rewrite_rules
- tasks
- testdata
- cases
- speech
- golden/speech
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
0 commit comments