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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(wake): GPU-turbo custom-phrase wake WITHOUT bias — fast + no hallucination
Ruben Lütke773fa90991d2
diff --git a/jarvis/plugins/stt/__init__.py b/jarvis/plugins/stt/__init__.pyindex f16162f06a..9f0b939eb1 100644--- a/jarvis/plugins/stt/__init__.py+++ b/jarvis/plugins/stt/__init__.py@@ -7,6 +7,7 @@ detector path keeps working when no cloud provider is registered."""from __future__ import annotations+from functools import lru_cachefrom importlib import metadata as importlib_metadatafrom typing import Any@@ -121,8 +122,28 @@ def build_stt_from_config(stt_cfg: Any) -> Any:)+@lru_cache(maxsize=1)+def _wake_cuda_available() -> bool:+ """True iff a CUDA device is usable by the CTranslate2 / faster-whisper backend.++ Cached (the device count is stable per process). Any import/probe error is+ treated as "no CUDA" so a host without the GPU stack degrades to the+ cloud-first CPU default. AP-21: gate on the capability, never a hardware name.+ """+ try:+ import ctranslate2++ return ctranslate2.get_cuda_device_count() > 0+ except Exception: # noqa: BLE001 - any failure means "treat as no GPU"+ return False++def build_wake_whisper(- stt_cfg: Any, *, language: str | None = None, wake_phrase: str | None = None+ stt_cfg: Any,+ *,+ language: str | None = None,+ wake_phrase: str | None = None,+ cuda_available: bool | None = None,) -> Any:"""Build the LOCAL wake-match / live-preview Whisper.@@ -164,11 +185,39 @@ def build_wake_whisper("""from jarvis.plugins.stt.fwhisper import FasterWhisperProvider+ model = getattr(stt_cfg, "wake_model", "base")+ device = getattr(stt_cfg, "wake_device", "cpu")+ compute = getattr(stt_cfg, "wake_compute_type", "int8")bias = wake_phrase.strip() if wake_phrase and wake_phrase.strip() else None++ # Capability-gated GPU upgrade (forensic 2026-06-24, validated on the user's+ # real wake WAVs). On the cloud-first CPU defaults (base/cpu) AND a CUDA+ # device, transcribe the wake on the GPU with a fast MULTILINGUAL turbo model+ # AND DROP THE BIAS. The strong model hears the proper noun WITHOUT the+ # ``initial_prompt`` hint, so the wake stays fast (~150 ms vs ~1.4 s on+ # base/cpu) while it does NOT hallucinate the primed phrase onto quiet+ # silence — the bias on the strong model was the false-wake source ("Vielen+ # Dank." silence artifact -> "Hey Ruben"). Offline-validated: no-bias turbo is+ # 0 false-wakes across the user's silence / own-speech / other-wake clips,+ # while a clearly spoken wake still fires. The WEAK base/cpu model still NEEDS+ # the bias to hear the name, so the bias is kept ONLY there. Only the+ # stt_match custom-phrase path on a GPU box is affected; the bundled+ # "Hey Jarvis"/openWakeWord path and every CPU/VPS host are untouched. An+ # explicit wake_model/wake_device wins (only the base/cpu pair auto-upgrades).+ if cuda_available is None:+ cuda_available = _wake_cuda_available()+ if model == "base" and device == "cpu" and cuda_available:+ model, device, compute = "large-v3-turbo", "cuda", "int8_float16"+ bias = None # strong model needs no bias; the bias is what hallucinates+ logger.info(+ "Wake-Whisper: CUDA present -> GPU turbo (large-v3-turbo/cuda), "+ "bias OFF (fast + no silence hallucination)."+ )+return FasterWhisperProvider(- model=getattr(stt_cfg, "wake_model", "base"),- device=getattr(stt_cfg, "wake_device", "cpu"),- compute_type=getattr(stt_cfg, "wake_compute_type", "int8"),+ model=model,+ device=device,+ compute_type=compute,language=language,initial_prompt=bias,)diff --git a/tests/unit/plugins/stt/test_wake_whisper_build.py b/tests/unit/plugins/stt/test_wake_whisper_build.pyindex 0ccc31cddd..bb7874f5af 100644--- a/tests/unit/plugins/stt/test_wake_whisper_build.py+++ b/tests/unit/plugins/stt/test_wake_whisper_build.py@@ -32,7 +32,8 @@ def test_build_wake_whisper_uses_wake_fields_not_utterance_model() -> None:wake_device="cpu",wake_compute_type="int8",)- p = build_wake_whisper(cfg)+ # cuda_available=False isolates this from the GPU auto-upgrade.+ p = build_wake_whisper(cfg, cuda_available=False)assert isinstance(p, FasterWhisperProvider)# The wake instance must NOT inherit the heavy utterance model / cuda.@@ -41,8 +42,28 @@ def test_build_wake_whisper_uses_wake_fields_not_utterance_model() -> None:assert p._compute_type == "int8"+def test_build_wake_whisper_gpu_turbo_drops_bias_when_cuda() -> None:+ # Capability-gated upgrade (forensic 2026-06-24): on a CUDA box the wake runs+ # the fast turbo model AND drops the bias — the strong model hears the name+ # without it, and the bias on a strong model is what hallucinated the wake+ # onto silence (the false-wake source). Offline-validated 0 false-wakes.+ p = build_wake_whisper(STTConfig(), wake_phrase="Hey Ruben", cuda_available=True)+ assert p._model_name == "large-v3-turbo"+ assert p._device == "cuda"+ assert p._initial_prompt is None # bias OFF on turbo+++def test_build_wake_whisper_cpu_keeps_bias() -> None:+ # The weak base/cpu model (no GPU / VPS) still NEEDS the bias to hear the+ # proper noun, so it is kept there.+ p = build_wake_whisper(STTConfig(), wake_phrase="Hey Ruben", cuda_available=False)+ assert p._model_name == "base"+ assert p._device == "cpu"+ assert p._initial_prompt == "Hey Ruben"++def test_build_wake_whisper_passes_language() -> None:- p = build_wake_whisper(STTConfig(), language="de")+ p = build_wake_whisper(STTConfig(), language="de", cuda_available=False)assert p._language == "de"@@ -51,7 +72,7 @@ def test_build_wake_whisper_tolerates_missing_wake_fields() -> None:class _Bare:pass- p = build_wake_whisper(_Bare())+ p = build_wake_whisper(_Bare(), cuda_available=False)assert p._model_name == "base"assert p._device == "cpu"assert p._compute_type == "int8"@@ -68,13 +89,17 @@ def test_build_wake_whisper_biases_prompt_with_custom_phrase() -> None:# no_speech_prob/RMS gates: false-wake stayed ~0% on real speech. So the bias# is re-enabled on this path. It is scoped to the custom phrase only -- the# OWW/"Hey Jarvis" paths pass no phrase and stay unbiased (test below).- p = build_wake_whisper(STTConfig(), language="de", wake_phrase="Hey Ruben")+ p = build_wake_whisper(+ STTConfig(), language="de", wake_phrase="Hey Ruben", cuda_available=False+ )assert p._initial_prompt == "Hey Ruben"def test_build_wake_whisper_default_has_no_prompt_bias() -> None:- p = build_wake_whisper(STTConfig(), language="de")+ p = build_wake_whisper(STTConfig(), language="de", cuda_available=False)assert p._initial_prompt is None- p_blank = build_wake_whisper(STTConfig(), language="de", wake_phrase=" ")+ p_blank = build_wake_whisper(+ STTConfig(), language="de", wake_phrase=" ", cuda_available=False+ )assert p_blank._initial_prompt is None