dsh-sensevoice-npu: DSH Speech-to-Text Provider for SenseVoiceSmall on Intel NPU

Preface

DeepSeek Harness (DSH) speech input uses the official experimental package @deepseek-ai/dsh-experimental-speech-to-text: the button, settings card, preparation screen, and speech API are all served by the same set of services, with different recognizer providers potentially hooked in behind it. The built-in dsh-experimental-speech-to-text-sensevoice is essentially a CPU path on Windows: the worker hardcodes provider: "cpu", and its bundled sherpa-onnx is also a CPU-only ONNX Runtime build, with the OpenVINO execution provider unavailable; even if forced onto OpenVINO, dynamic dimensions such as x_length in the model’s default graph would cause NPU compilation to crash.

If you are on a Core Ultra platform with an Intel NPU and want to move SenseVoiceSmall’s heavy computation onto the NPU without changing the speech-input UI and API, sakuraboy9128-cmd/dsh-sensevoice-npu takes the approach of registering an additional provider within the same voice-input stack: front-end features are aligned with sherpa-onnx, and inference runs on the NPU via OpenVINO.

What This Is

dsh-sensevoice-npu (current package version 0.2.0, MIT) is published by maintainer sakuraboy9128-cmd and categorized as model inference. In one sentence: within DSH’s local speech-to-text pipeline, it runs SenseVoiceSmall on an Intel NPU via OpenVINO and integrates with the official @deepseek-ai/dsh-experimental-speech-to-text service; the speech button, settings card, preparation UI, and speech API behavior remain unchanged—only the recognizer behind them is swapped.

The plugin does not bundle model downloads (downloadSources is empty); model files must be prepared once by the official SenseVoice provider, or placed manually at the agreed paths.

Differences from the Built-in CPU Provider

The README summarizes four reasons why the built-in path doesn’t work on the NPU, and how this plugin addresses them:

Built-in issue This plugin’s approach
recognizer / VAD hardcoded to CPU Standalone Python worker + OpenVINO; recognizer defaults to device: NPU
No ONNX Runtime package with OpenVINO on Windows Does not use sherpa-onnx’s OpenVINO EP; compiles the serving graph directly with OpenVINO
Default ONNX graph’s dynamic dimensions crash NPU compilation Bakes x_length to a constant for a specific frame bucket before compiling
— Exposes “one request, one WAV” recognition via a small loopback HTTP worker

Front-end processing (fbank, LFR, CMVN) matches the sherpa-onnx options, and transcription results are intended to align with the CPU provider; the heavy encoder/decoder runs on the NPU, while fbank and Silero VAD remain on the CPU (the VAD model is small with dynamic shapes, not suitable for the NPU).

Code Structure

Path Role
lib/index.js Cordis plugin: registers the provider, launches the worker, performs preparation
lib/worker.py Local-auth loopback HTTP worker (one WAV per request)
lib/sensevoice_npu.py Front-end features, Silero VAD, NPU session, CTC decoding
runtime/bootstrap.ps1 Creates the Python virtual environment needed by the worker

Model Files (relative to dataRoot)

The worker reads the following three files (they must be in place beforehand):

Path Approx. size
models/sensevoice-onnx/model.int8.onnx ~228 MB
models/sensevoice-onnx/tokens.txt ~0.3 MB
models/silero/silero_vad.onnx ~1.7 MB

The default dataRoot is <DSH home>/speech-to-text/sensevoice. You can first let the official dsh-experimental-speech-to-text-sensevoice provider download to the same directory, then install this plugin.

Installation and Activation

Environment requirements: 64-bit Python 3.11–3.13, Intel NPU driver; Node engine >=22.13 (see package.json). The following steps are excerpted from the README; replace the paths with your actual local locations.

1. Build the Python environment

pwsh -File runtime/bootstrap.ps1

2. Install into the profile holding the voice-input bundle

The DSH desktop app typically uses the desktop profile:

dsh plugin --profile desktop add "file:C:/path/to/dsh-sensevoice-npu"

During local iteration, pnpm copies the package; you can use a junction to point back to the working directory:

$d = "$env:USERPROFILE\.dsh\profiles\desktop\node_modules\dsh-sensevoice-npu"
Remove-Item -Recurse -Force $d
New-Item -ItemType Junction -Path $d -Target C:\path\to\dsh-sensevoice-npu

3. Optionally override the Cordis configuration

The bundled cordis.patch.yml already selects the provider and registers the plugin; pythonPath and dataRoot default to the bootstrap virtual environment and the DSH speech root directory. Only when the virtual environment or the DSH home directory is non-default should you back up and then edit ~/.dsh/profiles/desktop/cordis.patch.yml, appending something like:

- id: speech-to-text-npu
  name: 'dsh-sensevoice-npu'
  config:
    pythonPath: <custom venv>\Scripts\python.exe   # only with -VenvDir
    dataRoot: <custom speech root>                 # only with a non-default DSH_HOME

4. Restart DSH

The speech-input card should now show SenseVoiceSmall · Intel NPU (NPU) and be selected by default; the first preparation compiles the NPU graph once (about 2.5 minutes), and subsequent launches take about 0.2 s. If the CPU provider still shows, explicitly select NPU in the speech-input settings (an explicit selection overrides the patch default).

Configuration Options

Key Default value Meaning
pythonPath %LOCALAPPDATA%\dsh-sensevoice-npu\venv\Scripts\python.exe Worker interpreter
dataRoot <DSH home>/speech-to-text/sensevoice Models live under <dataRoot>/models
precision int8 int8 (model.int8.onnx) or fp32 (model.onnx)
device NPU OpenVINO device for the recognizer: NPU, GPU, CPU
vadDevice CPU Silero VAD device
useVad true Remove silence and segment long audio
buckets plugin configured as [256] (see README for the full list) LFR frame buckets—graph specs the engine can compile
prewarmBuckets [256] Buckets precompiled before the worker is ready
idleTimeoutMs 600000 Release the worker after idle; compiled blobs remain cached

The first compilation for each bucket takes about 2.5 minutes and uses about 800 MB of disk space (baked IR + OpenVINO NPU cache). For dictation scenarios, a single bucket of 256 frames (~15 s of audio) is usually sufficient.

Typical Usage and Measured Behavior

After installation and restart, usage is identical to the official speech input: click the speech button, select the provider in settings—no changes to the application-side speech API are needed.

The README’s reference data (not a universal guarantee) on Core Ultra X7 358H, Arc B390, NPU driver 32.0.100.5540:

Scenario Result
Hot start (compiled results cached) 0.21 s
4.5 s Chinese clip → 256-frame bucket Transcription correct, inference 0.66 s
5.2 s clip Transcription correct, 0.48 s
14.5 s clip Full sentence correct, 0.65 s
First compilation per bucket 100–145 s, cached afterwards

Note: for very short clips, the NPU path may not be faster than sherpa-onnx CPU (the README gives an example of about 0.5 s vs ~0.2 s); the main benefit is moving the encoder/decoder off heavy CPU/GPU onto the NPU.

For troubleshooting, you can check:

Get-Content "$env:USERPROFILE\.dsh\speech-to-text\sensevoice\npu\provider-status.json"

Common issues: NPU device not visible → update the Intel NPU driver (the README was tested on 32.0.100.5540); NPU compile failed → delete <dataRoot>/npu and retry, leaving about 1 GB/bucket of free disk space; the first run for a new bucket is slow due to compilation.

For development, you can run node --test (the README mentions 6 tests covering the registration contract and configuration validation).

Fit and Caveats

Who it’s for: Users already using SenseVoice speech input on DSH desktop (or a profile likewise mounting @deepseek-ai/dsh-experimental-speech-to-text); machines with an Intel NPU and willingness to run the PowerShell bootstrap and OpenVINO NPU compilation on Windows; those who want the UI and API unchanged and only the recognizer swapped.

Not suitable or things to know: The plugin runs with the current DSH process privileges; please read the GitHub repository source code and the MIT license before installing; the README’s installation and testing is centered on Windows / PowerShell, with no one-click path described for other OSes; it does not download models—you must supply them yourself or rely on the official SenseVoice provider to prepare the files; the community directory SkillHub plugin page and GitHub are independent sources of information and are not officially affiliated with DeepSeek / High-Flyer.

Closing

dsh-sensevoice-npu connects SenseVoiceSmall to DSH’s official speech-input stack, runs recognition on the Intel NPU via OpenVINO, and bakes frame buckets to work around NPU compilation limitations. If your pain point is that “the built-in SenseVoice can only run on CPU, yet I want to keep the original speech-input experience,” you can follow the README to prepare the models, bootstrap the environment, install via dsh plugin --profile desktop add "file:...", and restart to verify.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye