try to fix whisper issue

This commit is contained in:
ALIHAN DIKEL
2025-03-10 16:35:50 +03:00
parent 17b8341535
commit 738d9cc064

View File

@@ -59,6 +59,7 @@ class WhisperEngine:
"""Lazy-load the Whisper model on first use."""
if not self._model_loaded:
models_dir = os.environ.get("WHISPER_MODELS_DIR")
model_path = os.path.join(models_dir, f"{self.model_name}.pt")
# Check if models directory exists
if not os.path.exists(models_dir):
@@ -66,8 +67,8 @@ class WhisperEngine:
raise RuntimeError(f"Models directory '{models_dir}' not found. Please create it first.")
try:
logger.debug(f"Loading model '{self.model_name}' from {models_dir}")
self._model = whisper.load_model(self.model_name, download_root=models_dir, device=self.device)
logger.debug(f"Loading model '{self.model_name}' as from {model_path}")
self._model = whisper.load_model(model_path, device=self.device)
self._model_loaded = True
logger.debug(f"Successfully loaded model '{self.model_name}' on {self.device}")
except Exception as e: