mirror of
https://github.com/Alishahryar1/free-claude-code.git
synced 2026-05-01 21:00:44 +00:00
Remove auto support for whisper_device; only cpu and cuda allowed
- Validate whisper_device in Settings and _get_local_model - Reject 'auto' with clear ValueError/ValidationError - Update docs in config, .env.example, README - Add tests for invalid device and valid cpu/cuda Co-authored-by: Ali Khokhar <alishahryar2@gmail.com>
This commit is contained in:
parent
2135e6da05
commit
db646ef2db
6 changed files with 46 additions and 12 deletions
|
|
@ -80,7 +80,7 @@ class Settings(BaseSettings):
|
|||
hf_token: str = Field(default="", validation_alias="HF_TOKEN")
|
||||
# Model size: "tiny" | "base" | "small" | "medium" | "large-v2" | "large-v3" | "large-v3-turbo"
|
||||
whisper_model: str = Field(default="base", validation_alias="WHISPER_MODEL")
|
||||
# Device: "cpu" | "cuda" | "auto" (auto = try cuda, fail fast; no fallback)
|
||||
# Device: "cpu" | "cuda"
|
||||
whisper_device: str = Field(default="cpu", validation_alias="WHISPER_DEVICE")
|
||||
|
||||
# ==================== Bot Wrapper Config ====================
|
||||
|
|
@ -115,6 +115,13 @@ class Settings(BaseSettings):
|
|||
return None
|
||||
return v
|
||||
|
||||
@field_validator("whisper_device")
|
||||
@classmethod
|
||||
def validate_whisper_device(cls, v: str) -> str:
|
||||
if v not in ("cpu", "cuda"):
|
||||
raise ValueError(f"whisper_device must be 'cpu' or 'cuda', got {v!r}")
|
||||
return v
|
||||
|
||||
model_config = SettingsConfigDict(
|
||||
env_file=".env",
|
||||
env_file_encoding="utf-8",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue