SenseVoice-Small for RK3588: multilingual speech recognition with tags

Compiled model (.rnpu) for the Rockchip RK3588 / RK3588S NPU, ready to load: no FunASR, no ONNX export, no compiler run on your side. One fp16 graph for the own NPU stack of RCDL, a C++17 / Python library for vision and speech on these boards. RCDL's compiler built it from ONNX, and its runtime runs it by driving the board's rknpu kernel driver directly, so librknnrt and rknn-toolkit2 are not needed (how the stack works). It needs RCDL 0.3.1 or newer.

One recording of up to about 10 s goes in. Out come the text and three tags: the language, an emotion and an audio event. The model knows Chinese, English, Cantonese, Japanese and Korean.

Upstream: SenseVoice-Small, released through FunASR, compiled from sherpa-onnx's ONNX export of it.

Redistributable, with attribution. The FunASR Model License lets you use, copy, modify and share the weights, provided the source, the authors and the model's name are kept. These are the same terms as RCDL's Paraformer build. See Licence.

Files

file what it is size
sensevoice_small_166_fp16.rnpu the model: [1,166,560] LFR features, language, text_norm → [1,170,25055] logits (four tag rows, then one per LFR row) 481.1 MB
sensevoice_tokens.txt the vocabulary, the export's tokens.txt 0.3 MB
sensevoice_am.mvn CMVN statistics for the front end, from the export's metadata < 0.1 MB

One call holds 166 LFR rows, 9.96 s of audio. The front end (Kaldi fbank, LFR 7/6, CMVN) and the CTC decoding run on the CPU in RCDL. The export's length input is fixed at 166 rows in this build, which makes every shape static.

Measured on RK3588S and RK3588

RK3588S RK3588
a 5.9 s LibriSpeech sentence → text 378 ms 365 ms
its words 1 of 17 wrong (Quiter for Quilter); tags en, HAPPY, Speech the same
an AISHELL-1 Mandarin sentence 0 of 14 characters wrong; tag zh the same
Mandarin speech from rcdl-kokoro 0 of 14 characters wrong the same

RCDL 0.3.0 conda packages, RCDL's own NPU runtime, one NPU core, NPU driver 0.9.8; BSP kernel 6.1.118 on the RK3588S, 6.1.141 on the RK3588. The CPU governor was performance, with the process pinned to the four A76 cores. Under the boards' default schedutil, tasks that alternate NPU and CPU work measured up to about four times slower, with the same results.

On the four AISHELL-1 clips in RCDL's test data, every character is right, and every frame's argmax is the float model's.

Use it

On the board (linux-aarch64):

conda create -n rcdl -c https://mirrors.ruis.ai/conda -c conda-forge rcdl
conda activate rcdl
curl -LO https://huggingface.co/ruisv/rcdl-sensevoice/resolve/main/sensevoice_small_166_fp16.rnpu
curl -LO https://huggingface.co/ruisv/rcdl-sensevoice/resolve/main/sensevoice_tokens.txt
curl -LO https://huggingface.co/ruisv/rcdl-sensevoice/resolve/main/sensevoice_am.mvn
import wave, numpy as np, rcdl

def read(path):                                      # 16 kHz mono PCM16
    with wave.open(path) as w:
        assert (w.getframerate(), w.getnchannels(), w.getsampwidth()) == (16000, 1, 2)
        return np.frombuffer(w.readframes(w.getnframes()), np.int16)

asr = rcdl.SenseVoiceAsr.from_files(
    "sensevoice_small_166_fp16.rnpu", "sensevoice_tokens.txt", "sensevoice_am.mvn")
for name in ("zh.wav", "en.wav"):
    r = asr.transcribe(read(name))                   # language="auto", itn=True
    print(f"{name}: [{r.language} {r.emotion} {r.event}] {r.text}",
          "(truncated)" if r.truncated else "")

What to know before deploying

About 10 s per call, and a short clip costs about what a long one does. The input is a fixed 166 rows, so the NPU's work does not shrink with the clip. Audio longer than 9.96 s is cut and truncated is set on the result: segment longer recordings with a VAD first (rcdl-silero-vad), one utterance per call.

Choose the language and the text form per call. language is "auto", "zh", "en", "yue", "ja" or "ko"; any other is refused. itn=True, the default, adds punctuation and written-form numbers; itn=False gives the bare words. RCDL's own checks cover Mandarin and English; Cantonese, Japanese and Korean are the model's, not measured here.

There is no resampler. The input must already be 16 kHz mono, as float in [-1, 1] or int16. asr.features(pcm) and asr.transcribe_features(feats) split the front end from the model.

Licence

FunASR Model License. You may use, copy, modify and share these weights. You must attribute the source and the authors and keep the model's name: this is SenseVoice-Small from FunAudioLLM, released through FunASR, converted for RK3588 by RCDL. sensevoice_tokens.txt is the vocabulary of sherpa-onnx's export of the same model, and sensevoice_am.mvn holds the normalisation from that export's metadata, written by scripts/sensevoice_mvn.py.

RCDL itself is Apache-2.0 and is unrelated to these terms. It is a general-purpose runtime that loads any .rnpu or .rknn. The licence above applies to these weights and these files only.

The compiler flags of the build are in RCDL's scripts/fetch_models.sh, and its input contract in docs/MODELS.md.

中文说明

这是 SenseVoice-Small 面向瑞芯微 RK3588 / RK3588S NPU 的编译模型(.rnpu),下载即可 加载:不需要 FunASR,不用导出 ONNX,也不用自己跑编译器。这一个 fp16 计算图是为 RCDL 的自研 NPU 栈编译的:RCDL 的编译器从 ONNX 生成它, RCDL 的运行时直接驱动板子上的 rknpu 内核驱动来执行,不需要 librknnrt,也不需要 rknn-toolkit2(自研栈介绍)。 需要 RCDL 0.3.1 或更新版本。

输入一段最长约 10 s 的录音,输出文字和三个标签:语种、情感、音频事件。模型支持中文、英文、 粤语、日语和韩语。上游是 FunAudioLLM 通过 FunASR 发布的 SenseVoice-Small,这里由 sherpa-onnx 的 ONNX 导出编译而来。

可以再分发,但要署名。 FunASR 模型许可允许使用、复制、修改和分享权重,前提是保留来源、 作者和模型名称,与 RCDL 的 Paraformer 构建条款相同。

文件

文件 内容 大小
sensevoice_small_166_fp16.rnpu 模型:[1,166,560] LFR 特征、language、text_norm → [1,170,25055] logits(前四行是标签,之后每个 LFR 行一行) 481.1 MB
sensevoice_tokens.txt 词表,即导出包里的 tokens.txt 0.3 MB
sensevoice_am.mvn 前端用的 CMVN 统计量,取自导出模型的元数据 < 0.1 MB

一次调用容纳 166 个 LFR 行,即 9.96 s 音频。前端(Kaldi fbank、LFR 7/6、CMVN)和 CTC 解码 在 RCDL 里由 CPU 完成。导出模型的长度输入在这个构建里固定为 166 行,所以所有形状都是静态的。

实测

  • 一句 5.9 s 的 LibriSpeech 英文:RK3588S 上 378 ms,RK3588 上 365 ms;17 个词错 1 个 (把 Quilter 认成 Quiter),标签为 en、HAPPY、Speech。
  • 一句 AISHELL-1 普通话:14 个字错 0 个,标签 zh;rcdl-kokoro 合成的普通话识别回来也是 14 个字错 0 个。两块板结果相同。
  • 测量条件:RCDL 0.3.0 的 conda 包,自研 NPU 运行时,单个 NPU 核,NPU 驱动 0.9.8; RK3588S 为 BSP 内核 6.1.118,RK3588 为 6.1.141。CPU 调频策略为 performance,进程绑在 四个 A76 核上;在板子默认的 schedutil 下,NPU 与 CPU 交替工作的任务最多会慢到约四倍, 结果不变。
  • 在 RCDL 测试数据里的四段 AISHELL-1 音频上,每个字都识别正确,每一帧的 argmax 都与浮点模型相同。

用法

用法见上面的代码:装好 RCDL、下载三个文件,然后分别识别一段普通话和一段英文,打印语种、情感、 事件标签和文字。

部署前须知

  • 每次调用约 10 s,短音频的开销和长音频差不多。 输入固定为 166 行,NPU 的计算量不会随音频 变短而减少。超过 9.96 s 的部分会被截掉,结果里的 truncated 置位;更长的录音请先用 VAD (rcdl-silero-vad)切成单句,每句调用一次。
  • 语种和文本形式按次选择。 language 取 "auto"、"zh"、"en"、"yue"、"ja" 或 "ko",其他值会被拒绝。itn=True(默认)加标点并把数字写成书面形式,itn=False 只给原词。 RCDL 自己的检查只覆盖普通话和英文;粤语、日语和韩语是模型本身的能力,这里没有测。
  • 没有重采样。 输入必须已经是 16 kHz 单声道,float([-1, 1])或 int16 都可以。 asr.features(pcm) 和 asr.transcribe_features(feats) 可以把前端和模型分开调用。

许可

FunASR 模型许可(FunASR Model License)。 可以使用、复制、修改和分享这些权重,但必须注明 来源和作者,并保留模型名称:这是 FunAudioLLM 通过 FunASR 发布的 SenseVoice-Small,由 RCDL 转换到 RK3588。sensevoice_tokens.txt 是 sherpa-onnx 导出包里同一模型的词表, sensevoice_am.mvn 是用 scripts/sensevoice_mvn.py 从该导出模型的元数据写出的归一化参数。

RCDL 本身是 Apache-2.0,与上述条款无关。 它是通用运行时,能加载任何 .rnpu 或 .rknn;上述许可只适用于这些权重和这些文件。

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ruisv/rcdl-sensevoice

Finetuned
(30)
this model