enh: WHISPER_COMPUTE_TYPE env var

This commit is contained in:
Timothy Jaeryang Baek 2025-12-29 00:41:47 +04:00
parent 475dd91ed7
commit 26af1f92e2
2 changed files with 3 additions and 1 deletions

View file

@ -3675,6 +3675,7 @@ WHISPER_MODEL = PersistentConfig(
os.getenv("WHISPER_MODEL", "base"), os.getenv("WHISPER_MODEL", "base"),
) )
WHISPER_COMPUTE_TYPE = os.getenv("WHISPER_COMPUTE_TYPE", "int8")
WHISPER_MODEL_DIR = os.getenv("WHISPER_MODEL_DIR", f"{CACHE_DIR}/whisper/models") WHISPER_MODEL_DIR = os.getenv("WHISPER_MODEL_DIR", f"{CACHE_DIR}/whisper/models")
WHISPER_MODEL_AUTO_UPDATE = ( WHISPER_MODEL_AUTO_UPDATE = (
not OFFLINE_MODE not OFFLINE_MODE

View file

@ -38,6 +38,7 @@ from open_webui.utils.auth import get_admin_user, get_verified_user
from open_webui.utils.headers import include_user_info_headers from open_webui.utils.headers import include_user_info_headers
from open_webui.config import ( from open_webui.config import (
WHISPER_MODEL_AUTO_UPDATE, WHISPER_MODEL_AUTO_UPDATE,
WHISPER_COMPUTE_TYPE,
WHISPER_MODEL_DIR, WHISPER_MODEL_DIR,
CACHE_DIR, CACHE_DIR,
WHISPER_LANGUAGE, WHISPER_LANGUAGE,
@ -129,7 +130,7 @@ def set_faster_whisper_model(model: str, auto_update: bool = False):
faster_whisper_kwargs = { faster_whisper_kwargs = {
"model_size_or_path": model, "model_size_or_path": model,
"device": DEVICE_TYPE if DEVICE_TYPE and DEVICE_TYPE == "cuda" else "cpu", "device": DEVICE_TYPE if DEVICE_TYPE and DEVICE_TYPE == "cuda" else "cpu",
"compute_type": "int8", "compute_type": WHISPER_COMPUTE_TYPE,
"download_root": WHISPER_MODEL_DIR, "download_root": WHISPER_MODEL_DIR,
"local_files_only": not auto_update, "local_files_only": not auto_update,
} }