feat: log the resolved whisper device on bridge load
Some checks failed
Release / semantic-release (push) Successful in 24s
tests / Unit tests (Linux, Python 3.11) (push) Failing after 5m19s
Release / build-linux (push) Failing after 7m10s
Release / build-windows (push) Has been cancelled
Release / build-macos (arm64, macos-latest) (push) Has been cancelled
Release / build-macos (x64, macos-15-intel) (push) Has been cancelled
Release / release-main (push) Has been cancelled
Release / release-develop (push) Has been cancelled

The bridge only logged Whisper's device on the CPU-fallback path, so a
successful GPU (or silent CPU) load was invisible. Print the CTranslate2-
resolved device on success and on the fallback load, so it is verifiable that
STT is actually running on cuda alongside ollama (GPU) and MeloTTS (cuda).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-06-23 00:19:20 +09:00
parent e49be6d04e
commit 677bfcd2a9

View File

@@ -150,12 +150,17 @@ def _ensure_brain():
compute = os.environ.get("WHISPER_COMPUTE_TYPE", "auto") compute = os.environ.get("WHISPER_COMPUTE_TYPE", "auto")
try: try:
whisper = WhisperModel(cfg.whisper_model, device=device, compute_type=compute) whisper = WhisperModel(cfg.whisper_model, device=device, compute_type=compute)
# Log the device actually resolved by CTranslate2 (device="auto"
# picks cuda when available) so a silent CPU load is visible.
resolved = str(getattr(getattr(whisper, "model", None), "device", device)).lower()
print(f"[bridge] whisper loaded on {resolved} (compute={compute})", flush=True)
except Exception as ge: except Exception as ge:
# GPU not available / unsupported -> fall back to CPU so the # GPU not available / unsupported -> fall back to CPU so the
# bridge still works without a GPU passed to the container. # bridge still works without a GPU passed to the container.
if device != "cpu": if device != "cpu":
print(f"[bridge] whisper device='{device}' failed ({ge}); falling back to CPU", flush=True) print(f"[bridge] whisper device='{device}' failed ({ge}); falling back to CPU", flush=True)
whisper = WhisperModel(cfg.whisper_model, device="cpu", compute_type="int8") whisper = WhisperModel(cfg.whisper_model, device="cpu", compute_type="int8")
print("[bridge] whisper loaded on cpu (compute=int8)", flush=True)
else: else:
raise raise