fix: STT provider-model mismatch — whisper-1 fed to faster-whisper (#7113)

Legacy flat stt.model config key (from cli-config.yaml.example and older
versions) was passed as a model override to transcribe_audio() by the
gateway, bypassing provider-specific model resolution. When the provider
was 'local' (faster-whisper), this caused:
  ValueError: Invalid model size 'whisper-1'

Changes:
- gateway/run.py, discord.py: stop passing model override — let
  transcribe_audio() handle provider-specific model resolution internally
- get_stt_model_from_config(): now provider-aware, reads from the correct
  nested section (stt.local.model, stt.openai.model, etc.); ignores
  legacy flat key for local provider to prevent model name mismatch
- cli-config.yaml.example: updated STT section to show nested provider
  config structure instead of legacy flat key
- config migration v13→v14: moves legacy stt.model to the correct
  provider section and removes the flat key

Reported by community user on Discord.
This commit is contained in:
Teknium
2026-04-10 03:27:30 -07:00
committed by GitHub
parent 5a8b5f149d
commit 0f597dd127
7 changed files with 124 additions and 39 deletions

View File

@@ -96,12 +96,28 @@ _local_model_name: Optional[str] = None
def get_stt_model_from_config() -> Optional[str]:
"""Read the STT model name from ~/.hermes/config.yaml.
Returns the value of ``stt.model`` if present, otherwise ``None``.
Provider-aware: reads from the correct provider-specific section
(``stt.local.model``, ``stt.openai.model``, etc.). Falls back to
the legacy flat ``stt.model`` key only for cloud providers — if the
resolved provider is ``local`` the legacy key is ignored to prevent
OpenAI model names (e.g. ``whisper-1``) from being fed to
faster-whisper.
Silently returns ``None`` on any error (missing file, bad YAML, etc.).
"""
try:
from hermes_cli.config import read_raw_config
return read_raw_config().get("stt", {}).get("model")
stt_cfg = _load_stt_config()
provider = stt_cfg.get("provider", DEFAULT_PROVIDER)
# Read from the provider-specific section first
provider_model = stt_cfg.get(provider, {}).get("model")
if provider_model:
return provider_model
# Legacy flat key — only honour for non-local providers to avoid
# feeding OpenAI model names (whisper-1) to faster-whisper.
if provider not in ("local", "local_command"):
legacy = stt_cfg.get("model")
if legacy:
return legacy
except Exception:
pass
return None