From 0732bd9051e3dcfbda24feb4ec270637f2798285 Mon Sep 17 00:00:00 2001 From: teleprint-me <77757836+teleprint-me@users.noreply.github.com> Date: Mon, 27 May 2024 00:06:53 -0400 Subject: [PATCH] feat: Ignore pre-existing model files --- gguf-py/gguf/huggingface_hub.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gguf-py/gguf/huggingface_hub.py b/gguf-py/gguf/huggingface_hub.py index 53469835d..95a1b41f0 100644 --- a/gguf-py/gguf/huggingface_hub.py +++ b/gguf-py/gguf/huggingface_hub.py @@ -246,6 +246,12 @@ class HFHubModel(HFHubBase): def _request_single_file( self, model_repo: str, file_name: str, file_path: pathlib.Path ) -> bool: + # NOTE: Consider optional `force` parameter if files need to be updated. + # e.g. The model creator updated the vocabulary to resolve an issue or add a feature. + if file_path.exists(): + self.logger.info(f"skipped - downloaded {file_path} exists already.") + return False + # NOTE: Do not use bare exceptions! They mask issues! # Allow the exception to occur or explicitly handle it. try: