From 6b2f5555a4a0a1e8c4ab6a262da6e788588773d0 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Tue, 16 Sep 2025 14:17:20 -0700 Subject: [PATCH] OV cache location change --- voicebot/bots/minimal.py | 12 +++++++++++- voicebot/bots/whisper.py | 8 +++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/voicebot/bots/minimal.py b/voicebot/bots/minimal.py index 6b29506..68d9070 100644 --- a/voicebot/bots/minimal.py +++ b/voicebot/bots/minimal.py @@ -212,7 +212,7 @@ def create_minimal_bot_tracks(session_name: str, config: Optional[Dict[str, Any] - sample_rate: audio sample rate (default 48000) - frequency: tone frequency in Hz (default 440) - volume: audio volume 0-1 (default 0.5) - - static_color: RGB tuple for static mode (default gray) + - static_color: RGB color tuple or string (default (128, 128, 128)) Returns: Dictionary containing 'video' and 'audio' tracks @@ -235,6 +235,16 @@ def create_minimal_bot_tracks(session_name: str, config: Optional[Dict[str, Any] } default_config.update(config) # type: ignore + # Parse static_color if it's a string + if isinstance(default_config.get('static_color'), str): # type: ignore + try: + color_str = default_config['static_color'] # type: ignore + r, g, b = map(int, color_str.split(',')) # type: ignore + default_config['static_color'] = (r, g, b) + except (ValueError, TypeError): + logger.warning(f"Invalid static_color format: {default_config.get('static_color')}, using default") # type: ignore + default_config['static_color'] = (128, 128, 128) + media_clock = MediaClock() video_track = ConfigurableVideoTrack(media_clock, default_config) # type: ignore diff --git a/voicebot/bots/whisper.py b/voicebot/bots/whisper.py index 452adf1..3d69e62 100644 --- a/voicebot/bots/whisper.py +++ b/voicebot/bots/whisper.py @@ -156,7 +156,7 @@ class OpenVINOConfig(BaseModel): device: str = Field(default=_device, description="Target device for inference") cache_dir: str = Field( - default="./ov_cache", description="Cache directory for compiled models" + default="/root/.cache", description="Cache directory for compiled models" ) enable_quantization: bool = Field( default=True, description="Enable INT8 quantization" @@ -510,8 +510,10 @@ class OpenVINOWhisperModel: self.model_id = model_id self.config = config self.device = device - self.model_path = Path(model_id.replace("/", "_")) - self.quantized_model_path = Path(f"{self.model_path}_quantized") + # Ensure cache directory exists + Path(self.config.cache_dir).mkdir(parents=True, exist_ok=True) + self.model_path = Path(self.config.cache_dir) / model_id.replace("/", "_") + self.quantized_model_path = self.model_path / "quantized" self.processor: Optional[WhisperProcessor] = None self.ov_model: Optional[OVModelForSpeechSeq2Seq] = None