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(stt): build int8 GPU requests as float16 — the int8 kernels crawl on this card

rubenluetke10-beepe33c1788adbb
diff --git a/jarvis/plugins/stt/fwhisper.py b/jarvis/plugins/stt/fwhisper.py
index ee16fac2a5..13507db13a 100644
--- a/jarvis/plugins/stt/fwhisper.py
+++ b/jarvis/plugins/stt/fwhisper.py
@@ -404,6 +404,46 @@ def ensure_cuda_libraries_findable() -> None:
return
+_GPU_COMPUTE_REMAP_LOGGED: set[str] = set()
+
+
+def _gpu_compute_type(device: str, compute_type: str) -> str:
+ """The compute type a GPU engine is REALLY built with.
+
+ Measured 2026-08-22 on a Blackwell card with ctranslate2 4.8: the int8
+ pairs (``int8_float16``, ``int8``) decode 8 s of real speech in 10-11 s,
+ ``float16`` in 0.7 s, the CPU in 1.2 s — so the shipped GPU default was
+ slower than no GPU at all. With large-v3 that became "one to two minutes
+ for three words" and every dictation ran into the 15 s provider ceiling.
+ The int8 path on a GPU saves memory and nothing else a recognizer needs,
+ so on CUDA an int8 request becomes ``float16`` whenever the runtime says
+ it can do it; CPU requests are untouched (``_cpu_safe_compute_type`` owns
+ those). Gated on the runtime's own capability list, never on a GPU name
+ (AP-21). Never raises: a runtime that cannot answer keeps the request.
+ """
+ if device.lower() == "cpu" or not compute_type.lower().startswith("int8"):
+ return compute_type
+ try:
+ import ctranslate2 # noqa: PLC0415 — lazy, the GPU path only
+
+ supported = set(ctranslate2.get_supported_compute_types(device))
+ except Exception as exc: # noqa: BLE001 — no answer means no remap
+ log.debug("GPU compute-type probe failed (%s); keeping %s.", exc, compute_type)
+ return compute_type
+ if "float16" not in supported:
+ return compute_type
+ if compute_type not in _GPU_COMPUTE_REMAP_LOGGED:
+ _GPU_COMPUTE_REMAP_LOGGED.add(compute_type)
+ log.info(
+ "Whisper on %s: building with float16 instead of the configured %s "
+ "— the int8 kernels run an order of magnitude slower on this GPU "
+ "(measured 10-11 s vs 0.7 s for 8 s of speech).",
+ device,
+ compute_type,
+ )
+ return "float16"
+
+
def _new_whisper_model(
model_name: str, device: str, compute_type: str, cpu_threads: int = 0
) -> Any:
@@ -432,6 +472,7 @@ def _new_whisper_model(
with inference_only_import_shield():
from faster_whisper import WhisperModel
+ compute_type = _gpu_compute_type(device, compute_type)
kwargs: dict[str, Any] = {"device": device, "compute_type": compute_type}
if cpu_threads and cpu_threads > 0:
kwargs["cpu_threads"] = int(cpu_threads)
diff --git a/tests/unit/plugins/stt/test_fwhisper_gpu_compute_type.py b/tests/unit/plugins/stt/test_fwhisper_gpu_compute_type.py
new file mode 100644
index 0000000000..8862f5e119
--- /dev/null
+++ b/tests/unit/plugins/stt/test_fwhisper_gpu_compute_type.py
@@ -0,0 +1,68 @@
+"""On CUDA an int8 request is built as float16 — the int8 kernels measured 10x
+slower on a Blackwell card (ctranslate2 4.8): large-v3 took 1-2 minutes for
+three words and ran into the 15 s provider ceiling. CPU requests are untouched.
+"""
+
+from __future__ import annotations
+
+import sys
+from types import SimpleNamespace
+
+import pytest
+
+import jarvis.plugins.stt.fwhisper as fwhisper
+
+
+def _runtime(monkeypatch: pytest.MonkeyPatch, supported: set[str]) -> None:
+ monkeypatch.setitem(
+ sys.modules,
+ "ctranslate2",
+ SimpleNamespace(get_supported_compute_types=lambda _device: supported),
+ )
+
+
+def test_int8_on_cuda_becomes_float16_when_the_runtime_can(monkeypatch: pytest.MonkeyPatch) -> None:
+ _runtime(monkeypatch, {"int8", "int8_float16", "float16"})
+ assert fwhisper._gpu_compute_type("cuda", "int8_float16") == "float16"
+ assert fwhisper._gpu_compute_type("cuda", "int8") == "float16"
+
+
+def test_float16_requests_and_cpu_requests_are_untouched(monkeypatch: pytest.MonkeyPatch) -> None:
+ _runtime(monkeypatch, {"int8", "int8_float16", "float16"})
+ assert fwhisper._gpu_compute_type("cuda", "float16") == "float16"
+ assert fwhisper._gpu_compute_type("cpu", "int8_float16") == "int8_float16"
+ assert fwhisper._gpu_compute_type("cpu", "int8") == "int8"
+
+
+def test_a_runtime_without_float16_keeps_the_request(monkeypatch: pytest.MonkeyPatch) -> None:
+ _runtime(monkeypatch, {"int8", "int8_float16"})
+ assert fwhisper._gpu_compute_type("cuda", "int8_float16") == "int8_float16"
+
+
+def test_a_runtime_that_cannot_answer_keeps_the_request(monkeypatch: pytest.MonkeyPatch) -> None:
+ monkeypatch.setitem(
+ sys.modules,
+ "ctranslate2",
+ SimpleNamespace(
+ get_supported_compute_types=lambda _d: (_ for _ in ()).throw(RuntimeError("no CUDA"))
+ ),
+ )
+ assert fwhisper._gpu_compute_type("cuda", "int8_float16") == "int8_float16"
+
+
+def test_the_constructor_hands_the_remapped_type_to_the_engine(monkeypatch: pytest.MonkeyPatch) -> None:
+ _runtime(monkeypatch, {"int8", "int8_float16", "float16"})
+ built: list[dict] = []
+
+ class _Model:
+ def __init__(self, name: str, **kwargs: object) -> None:
+ built.append({"name": name, **kwargs})
+
+ monkeypatch.setitem(sys.modules, "faster_whisper", SimpleNamespace(WhisperModel=_Model))
+ monkeypatch.setattr(fwhisper, "ensure_cuda_libraries_findable", lambda: None)
+
+ fwhisper._new_whisper_model("large-v3", "cuda", "int8_float16")
+ fwhisper._new_whisper_model("large-v3", "cpu", "int8")
+
+ assert built[0]["compute_type"] == "float16"
+ assert built[1]["compute_type"] == "int8"