Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(voice): bundle the Silero VAD model in base so end-of-speech works on any machine

Ruben Lütkea769b2c63e55
diff --git a/.gitignore b/.gitignore
index 6fa353cc0a..eca2fe454a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -63,6 +63,11 @@ data/**/
*.ppn
*.onnx
models/
+# ...but the ONNX model assets we deliberately BUNDLE and ship in-repo are tracked
+# (the openWakeWord wake models and the Silero VAD model). They must ship in the
+# base wheel so wake + end-of-speech detection work out-of-the-box on a fresh
+# install — the whole point is that they are NOT the ignored user/cache models.
+!jarvis/assets/**/*.onnx
# Audio-Blobs + Flight-Recorder-Traces
blobs/
diff --git a/jarvis/assets/__init__.py b/jarvis/assets/__init__.py
index 42ed972de2..250242189f 100644
--- a/jarvis/assets/__init__.py
+++ b/jarvis/assets/__init__.py
@@ -5,9 +5,14 @@ Currently:
neutral shipped default, hey_jarvis_v0.1 kept for users who type "Jarvis",
melspectrogram, embedding). Loaded via :func:`bundled_wakeword_models` from
the openWakeWord provider so first-boot stays offline.
+- ``vad/``: the Silero VAD ONNX model (MIT-licensed, ~2.2 MB) that powers
+ end-of-speech detection (:mod:`jarvis.audio.vad`). Bundled so the core voice
+ loop closes a turn on a base install too: the ``silero-vad`` pip package (which
+ drags torch) lives only in the ``[local-voice]`` extra, but the model file
+ itself is torch-free and run via base ``onnxruntime``. Loaded via
+ :func:`bundled_silero_vad_model`.
-Future bundles (e.g. local VAD profiles, packaged voice clips) live under this
-package.
+Future bundles (e.g. packaged voice clips) live under this package.
"""
from __future__ import annotations
@@ -20,6 +25,9 @@ _WAKEWORD_FILES = {
"embedding": "embedding_model.onnx",
}
+_VAD_DIR = Path(__file__).resolve().parent / "vad"
+_SILERO_VAD_FILE = "silero_vad.onnx"
+
def bundled_wakeword_models() -> dict[str, Path] | None:
"""Return absolute paths to the bundled openWakeWord ONNX assets.
@@ -43,4 +51,21 @@ def bundled_wakeword_models() -> dict[str, Path] | None:
return resolved
-__all__ = ["bundled_wakeword_models"]
+def bundled_silero_vad_model() -> Path | None:
+ """Return the absolute path to the bundled Silero VAD ONNX model, or ``None``.
+
+ ``None`` when the file is missing (partial checkout / slim install); the
+ caller (:meth:`jarvis.audio.vad.SileroEndpointer._ensure_model`) then falls
+ back to locating the model inside the installed ``silero-vad`` pip package.
+
+ Bundling this ~2.2 MB MIT model in-repo is what makes end-of-speech detection
+ work out-of-the-box on a fresh base install — without it the voice loop can
+ hear a wake word but never close the utterance, because ``silero-vad`` is an
+ opt-in extra. The bundled file is byte-identical to the pip package's model,
+ so the torch-free onnxruntime inference in ``vad.py`` is unchanged.
+ """
+ path = _VAD_DIR / _SILERO_VAD_FILE
+ return path if path.is_file() else None
+
+
+__all__ = ["bundled_wakeword_models", "bundled_silero_vad_model"]
diff --git a/jarvis/assets/vad/LICENSE b/jarvis/assets/vad/LICENSE
new file mode 100644
index 0000000000..0bf5e90cac
--- /dev/null
+++ b/jarvis/assets/vad/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2020-present Silero Team
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/jarvis/assets/vad/silero_vad.onnx b/jarvis/assets/vad/silero_vad.onnx
new file mode 100644
index 0000000000..80c5592ef1
Binary files /dev/null and b/jarvis/assets/vad/silero_vad.onnx differ
diff --git a/jarvis/audio/vad.py b/jarvis/audio/vad.py
index 88125710da..146df7a160 100644
--- a/jarvis/audio/vad.py
+++ b/jarvis/audio/vad.py
@@ -196,21 +196,40 @@ class SileroEndpointer:
def _ensure_model(self) -> None:
if self._session is not None:
return
- # Locate the bundled Silero ONNX model WITHOUT importing the silero_vad
- # package (its __init__ -> model.py does ``import torch`` at module
- # level, which is exactly the multi-second cost we are avoiding).
- # ``find_spec`` resolves the install path without executing the package.
- import importlib.util
import os
import onnxruntime # already warm: the wake model imported it
- spec = importlib.util.find_spec("silero_vad")
- if spec is None or spec.origin is None:
- raise RuntimeError("silero_vad package not installed")
- model_path = os.path.join(
- os.path.dirname(spec.origin), "data", "silero_vad.onnx"
- )
+ # Prefer the model bundled in-repo (jarvis/assets/vad/silero_vad.onnx):
+ # it ships in EVERY base install, so end-of-speech detection works out of
+ # the box without the opt-in ``silero-vad`` pip package (which drags torch,
+ # so it stays in the [local-voice] extra). Before this was bundled the
+ # voice loop could hear the wake word but never close the utterance on a
+ # fresh install — the wake fired, then this raised and the turn died.
+ # We still never IMPORT the silero_vad package (its __init__ -> model.py
+ # does ``import torch`` at module level, exactly the multi-second cost we
+ # avoid); the bundled ONNX is byte-identical and run torch-free here.
+ from jarvis.assets import bundled_silero_vad_model
+
+ bundled = bundled_silero_vad_model()
+ if bundled is not None:
+ model_path = str(bundled)
+ else:
+ # Fallback for a partial checkout / slim layout without the bundled
+ # asset: locate the model inside an installed silero_vad package.
+ # ``find_spec`` resolves the install path without executing it.
+ import importlib.util
+
+ spec = importlib.util.find_spec("silero_vad")
+ if spec is None or spec.origin is None:
+ raise RuntimeError(
+ "Silero VAD model unavailable: neither the bundled asset "
+ "(jarvis/assets/vad/silero_vad.onnx) nor the silero_vad package "
+ "was found"
+ )
+ model_path = os.path.join(
+ os.path.dirname(spec.origin), "data", "silero_vad.onnx"
+ )
opts = onnxruntime.SessionOptions()
opts.inter_op_num_threads = 1
opts.intra_op_num_threads = 1
diff --git a/pyproject.toml b/pyproject.toml
index 8e615b1fed..8c824c605f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -219,19 +219,24 @@ desktop-macos = [
# the headless server boot without them.
#
# torch note: NONE of Jarvis's own code imports torch on any runtime path — the
-# VAD runs the bundled Silero ONNX via onnxruntime (jarvis/audio/vad.py), STT
-# uses ctranslate2 (faster-whisper), wake uses onnxruntime/tflite. torch is only
-# an UNUSED transitive dependency of the `silero-vad` package (its own model
-# loader imports it), so it arrives with this opt-in extra but is never executed;
-# a normal/base install pulls no torch and no NVIDIA/CUDA wheels at all.
+# VAD runs the bundled Silero ONNX (jarvis/assets/vad/silero_vad.onnx) via
+# onnxruntime (jarvis/audio/vad.py), STT uses ctranslate2 (faster-whisper), wake
+# uses onnxruntime/tflite. torch is only an UNUSED transitive dependency of the
+# `silero-vad` package (its own model loader imports it), so it arrives with this
+# opt-in extra but is never executed; a normal/base install pulls no torch and no
+# NVIDIA/CUDA wheels at all.
# `sentence-transformers` was removed 2026-07-01: it had ZERO importers in jarvis/
# (an embedding vestige) yet dragged in torch + a large transformers/HF tree.
# openwakeword + onnxruntime moved to BASE 2026-07-04 (torch-free, ~15 MB) so the
# always-on neural wake fires out-of-the-box on any machine — they are NO LONGER
-# here. This extra now covers only the heavier local paths: the torch-pulling
-# Silero VAD, WebRTC VAD, and the Porcupine wake engine. (faster-whisper — the
-# local-Whisper arbitrary-custom-phrase wake for phrases with no pretrained model
-# — is not in any extra; it is pulled on demand by the in-app "enable local
+# here. The Silero VAD *model* moved to BASE too (2026-07-04): it is bundled as an
+# ~2.2 MB MIT asset under jarvis/assets/vad/ and run torch-free via onnxruntime, so
+# end-of-speech detection also works out-of-the-box — the `silero-vad` PACKAGE
+# below is now only an optional fallback for a partial checkout without the asset.
+# This extra therefore covers only heavier/alternate local paths: the torch-pulling
+# silero-vad package, WebRTC VAD, and the Porcupine wake engine. (faster-whisper —
+# the local-Whisper arbitrary-custom-phrase wake for phrases with no pretrained
+# model — is not in any extra; it is pulled on demand by the in-app "enable local
# speech" installer, see jarvis/ui/web/settings_routes.py.)
local-voice = [
"silero-vad>=5.1",
diff --git a/tests/unit/audio/test_vad_bundled_model.py b/tests/unit/audio/test_vad_bundled_model.py
new file mode 100644
index 0000000000..acd3692b22
--- /dev/null
+++ b/tests/unit/audio/test_vad_bundled_model.py
@@ -0,0 +1,95 @@
+"""The Silero VAD model ships in the BASE install (regression guard).
+
+This pins the fix for the "voice only works on the maintainer's machine" bug
+(2026-07-04). End-of-speech detection (``jarvis/audio/vad.py``) runs the Silero
+ONNX model torch-free via base ``onnxruntime`` — but the model FILE used to be
+reachable only inside the ``silero-vad`` pip package, which lives in the opt-in
+``[local-voice]`` extra. So on a fresh base install the wake word fired, then the
+first voice frame raised ``RuntimeError('silero_vad package not installed')`` and
+the utterance was never captured: Jarvis kept "listening" and never advanced.
+
+The model is now bundled as an ~2.2 MB MIT asset under ``jarvis/assets/vad/`` and
+loaded from there first (the ``silero-vad`` package is only a fallback). These
+tests fail-closed against that recurring: the asset must ship, the loader must use
+it without the package, and the (heavier, torch-pulling) package must stay an extra.
+"""
+from __future__ import annotations
+
+import importlib.util
+import tomllib
+from pathlib import Path
+
+from packaging.requirements import Requirement
+
+from jarvis.assets import bundled_silero_vad_model
+from jarvis.audio.vad import SileroEndpointer
+
+REPO_ROOT = Path(__file__).resolve().parents[3]
+PYPROJECT = REPO_ROOT / "pyproject.toml"
+
+
+def _base_dep_names() -> set[str]:
+ data = tomllib.loads(PYPROJECT.read_text(encoding="utf-8"))
+ deps = data.get("project", {}).get("dependencies", [])
+ return {Requirement(d).name.lower().replace("_", "-") for d in deps}
+
+
+def _local_voice_names() -> set[str]:
+ data = tomllib.loads(PYPROJECT.read_text(encoding="utf-8"))
+ extras = data.get("project", {}).get("optional-dependencies", {})
+ return {
+ Requirement(d).name.lower().replace("_", "-")
+ for d in extras.get("local-voice", [])
+ }
+
+
+def test_silero_vad_model_is_bundled() -> None:
+ path = bundled_silero_vad_model()
+ assert path is not None, (
+ "The Silero VAD model must be bundled under jarvis/assets/vad/ so "
+ "end-of-speech detection works on a fresh base install. Without it the "
+ "voice loop hears the wake word but never closes the utterance."
+ )
+ assert path.is_file()
+ assert path.suffix == ".onnx"
+ assert path.stat().st_size > 1_000_000, "the Silero ONNX model looks truncated"
+
+
+def test_silero_vad_package_stays_in_local_voice_not_base() -> None:
+ """The MODEL is base; the torch-pulling PACKAGE stays an opt-in extra.
+
+ Bundling the model is exactly what lets the ``silero-vad`` package (which drags
+ torch) stay out of the base install without breaking the default VAD.
+ """
+ base = _base_dep_names()
+ assert "silero-vad" not in base, (
+ "silero-vad pulls torch and must NOT be a base dependency — the model is "
+ "bundled instead (jarvis/assets/vad/), so base needs only onnxruntime."
+ )
+ assert "silero-vad" in _local_voice_names()
+
+
+def test_ensure_model_loads_from_bundle_without_the_package(monkeypatch) -> None:
+ """``_ensure_model`` must load the bundled asset and never touch the package.
+
+ We make ``importlib.util.find_spec('silero_vad')`` explode: if the loader falls
+ through to the package path (the old behaviour) the test fails, proving the
+ bundled asset is used. ``onnxruntime`` is a base dependency, so the real
+ inference session is built here — no mocking of the runtime.
+ """
+ original_find_spec = importlib.util.find_spec
+
+ def _guard(name: str, *args, **kwargs):
+ if name == "silero_vad":
+ raise AssertionError(
+ "the bundled asset must be used; the silero_vad PACKAGE path was "
+ "reached — end-of-speech detection would break on a base install"
+ )
+ return original_find_spec(name, *args, **kwargs)
+
+ monkeypatch.setattr(importlib.util, "find_spec", _guard)
+
+ ep = SileroEndpointer()
+ ep._ensure_model() # must NOT raise and must NOT consult the package
+
+ assert ep._session is not None