Size-optimized onnxruntime build for Silero Voice Activation Detection (VAD).
Find a file
2026-06-20 19:42:06 -04:00
.forgejo/workflows switch from silero v5 to silero v6 (16k, opset v. 15) model 2026-05-20 07:13:17 -04:00
onnxruntime@2582b9bc60 wip 2026-05-19 13:59:28 -04:00
.gitmodules add a test workflow 2026-05-19 13:06:09 -04:00
package.json try publishing! 2026-05-19 14:59:33 -04:00
README.md switch from silero v5 to silero v6 (16k, opset v. 15) model 2026-05-20 07:13:17 -04:00
silero_vad_v6_16k_op15.ort switch from silero v5 to silero v6 (16k, opset v. 15) model 2026-05-20 07:13:17 -04:00
silero_vad_v6_16k_op15.required_operators.config Enable type restrictions 2026-06-20 19:42:06 -04:00

ort-silero-vad-wasm-minimal

This is a WebAssembly build of onnx for Silero Voice Activity Detection (VAD). It's much smaller because we disable every operation that model does not need, as well as most optional features. We also use a build optimized for size, not speed. Silero VAD is tiny and fast, so this is a good trade-off for my use case!

- dist/assets/ort-wasm-simd-threaded-CDsxkEtH.wasm  13,022.40 kB │ gzip: 3,391.83 kB
+ dist/assets/ort-wasm-simd-threaded-Da1-zUmH.wasm  1,364.31 kB │ gzip: 476.09 kB

Basically, if you happen to be using ONNX specifically for Silero, you can reduce the uncompressed wasm size from 13MB to 1.4MB by installing and using this module.

Add this to your project's .npmrc:

@jocelyn-stericker:registry=https://codeberg.org/api/packages/jocelyn-stericker/npm/

Install a pinned version (I do not guarantee compatibility from one build to another):

npm install --save-exact @jocelyn-stericker/ort-silero-vad-wasm-minimal

Then, initialize onnxruntime (ort) like:

import * as ort from 'onnxruntime-web/wasm' // NOT from this module!

import ortMjsUrl from '@jocelyn-stericker/ort-silero-vad-wasm-minimal/ort-wasm-simd-threaded.mjs?url'
import ortWasmUrl from '@jocelyn-stericker/ort-silero-vad-wasm-minimal/ort-wasm-simd-threaded.wasm?url'
import vadModelUrl from '@jocelyn-stericker/ort-silero-vad-wasm-minimal/silero_vad_v6_16k_op15.ort?url'

ort.env.wasm.wasmPaths = { wasm: ortWasmUrl, mjs: ortMjsUrl }
ort.InferenceSession.create(vadModelUrl).then((sess) => { ... }

Finally, you'll need to add onnxruntime-web-use-extern-wasm as an import condition in your bundler to avoid loading both models. e.g., in vite.config.ts:

const config = defineConfig({
  resolve: {
    conditions: ['onnxruntime-web-use-extern-wasm']
  }
})

But realistically, I don't expect anyone else to use this. Feel free if you want, but it's probably easier to fork this or vibe code your own build! If I can help for either case, please reach out!

Build

The pipeline is on ./.forgejo/workflows/ci.yaml. It runs on push. The version number bumps every time it runs.