diff --git a/scripts/models/audio/fast_whisper_objects.py b/scripts/models/audio/fast_whisper_objects.py index 0c76cdf..87f9831 100644 --- a/scripts/models/audio/fast_whisper_objects.py +++ b/scripts/models/audio/fast_whisper_objects.py @@ -32,7 +32,7 @@ def get_models_to_download() -> tuple: """ Select which Hugging Face model identifiers should be downloaded for the current platform. - + Returns: tuple: Tuple of model identifier strings — on Raspberry Pi this is the base models tuple, otherwise the base models concatenated with the extended models tuple. """ @@ -45,7 +45,7 @@ def get_models_to_download() -> tuple: def run() -> None: """ Download the selected Hugging Face models and store them in the user's local cache. - + Selects models appropriate for the current platform, skips models that are already present in the cache, downloads any missing models into the configured cache directory, and prints progress messages for each model. """ models_to_download = get_models_to_download() @@ -61,4 +61,4 @@ def run() -> None: if __name__ == "__main__": - run() \ No newline at end of file + run() diff --git a/scripts/models/audio/load_huggingface_objects.py b/scripts/models/audio/load_huggingface_objects.py index 7a3c00c..6eb173c 100644 --- a/scripts/models/audio/load_huggingface_objects.py +++ b/scripts/models/audio/load_huggingface_objects.py @@ -25,7 +25,7 @@ def run() -> None: """ Download and save configured Hugging Face models, tokenizers, processors, and datasets to the local user cache. - + This function iterates over the module-level `model_names` and `data_set_names`, skipping entries already present in `cache_dir`. For each missing repository it attempts to download a snapshot into `cache_dir` and prints progress and completion messages. If a repository is not found or is gated, it prints a corresponding message and continues with the next item. """ # repo_type="model" if None is by default "model" - Not mandatory but for clarity @@ -64,4 +64,4 @@ def run() -> None: if __name__ == "__main__": - run() \ No newline at end of file + run() diff --git a/scripts/models/audio/models_check.py b/scripts/models/audio/models_check.py index f5a2eeb..f680776 100644 --- a/scripts/models/audio/models_check.py +++ b/scripts/models/audio/models_check.py @@ -7,9 +7,9 @@ def model_exists(model_name: str, target_dir: str) -> bool: """ Determine whether a model whose name contains the given substring exists in the target directory. - + Searches the resolved target directory for any entry whose name contains model_name. Symlinks are followed and both directories and regular files (e.g., model files like `.pt`) are considered matches. - + Returns: True if a matching file or directory exists in target_dir, False otherwise. """ @@ -23,4 +23,4 @@ def model_exists(model_name: str, target_dir: str) -> bool: # entry.exists() follows symlinks by default if entry.is_dir() or entry.is_file(): return True - return False \ No newline at end of file + return False diff --git a/scripts/models/audio/whisper_objects.py b/scripts/models/audio/whisper_objects.py index 3f1038e..6b320b7 100644 --- a/scripts/models/audio/whisper_objects.py +++ b/scripts/models/audio/whisper_objects.py @@ -47,7 +47,7 @@ def get_models_to_download() -> dict: """ Selects the set of Whisper model download mappings appropriate for the current platform. - + Returns: dict: Mapping of model names to their download URLs. On Raspberry Pi systems returns `MODELS_BASE`; on other platforms returns a merged mapping of `MODELS_BASE` and `MODELS_EXTENDED`. """ @@ -60,9 +60,9 @@ def get_models_to_download() -> dict: def download_file(url: str, target_dir: str, filename: str = None) -> None: """ Download a file from a URL into a target directory, skipping or resuming as appropriate. - + Checks for an existing model/file using `model_exists` and skips download if present. Ensures the target directory exists (resolving symlinks), then downloads the URL to the given filename (defaults to the URL's final path segment). If a partial file is present, attempts to resume using HTTP Range requests; if the server does not support resuming, restarts the download. Handles HTTP 416 as an already-complete file and reports network or filesystem errors via printed messages. - + Parameters: url (str): The source URL of the file to download. target_dir (str): Directory path where the file will be saved; created if missing. @@ -135,7 +135,7 @@ def download_file(url: str, target_dir: str, filename: str = None) -> None: def run() -> None: """ Download Whisper models and related tokenizer and processor files into the module cache directory. - + Uses the whisper library to fetch models returned by get_models_to_download and saves them under cache_dir; if the library download fails, falls back to manually downloading model weight files. Also downloads configured GPT-2 support files into the same cache location. """ print(f"Target directory: {cache_dir}") @@ -163,4 +163,4 @@ def run() -> None: if __name__ == "__main__": - run() \ No newline at end of file + run() diff --git a/src/audio/voice_agent_offline.py b/src/audio/voice_agent_offline.py index 51e4a34..703882f 100644 --- a/src/audio/voice_agent_offline.py +++ b/src/audio/voice_agent_offline.py @@ -535,7 +535,7 @@ def __init__(self, tts_config: AgentConfig): def _validate_piper_model(self): """ Ensure the configured Piper TTS model file exists and load it into the engine. - + Raises: FileNotFoundError: If `self.config.tts_model_path` does not point to an existing file. """ @@ -1002,4 +1002,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main()