Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scripts/models/audio/fast_whisper_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand All @@ -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()
Expand All @@ -61,4 +61,4 @@ def run() -> None:


if __name__ == "__main__":
run()
run()
4 changes: 2 additions & 2 deletions scripts/models/audio/load_huggingface_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -64,4 +64,4 @@ def run() -> None:


if __name__ == "__main__":
run()
run()
6 changes: 3 additions & 3 deletions scripts/models/audio/models_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand All @@ -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
return False
10 changes: 5 additions & 5 deletions scripts/models/audio/whisper_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
"""
Expand All @@ -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.
Expand Down Expand Up @@ -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}")
Expand Down Expand Up @@ -163,4 +163,4 @@ def run() -> None:


if __name__ == "__main__":
run()
run()
4 changes: 2 additions & 2 deletions src/audio/voice_agent_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down Expand Up @@ -1002,4 +1002,4 @@ def main():


if __name__ == "__main__":
main()
main()
Loading