feat: Ignore pre-existing model files

This commit is contained in:
teleprint-me 2024-05-27 00:06:53 -04:00
parent b1c922fec7
commit 0732bd9051
No known key found for this signature in database
GPG key ID: B0D11345E65C4D48

View file

@ -246,6 +246,12 @@ class HFHubModel(HFHubBase):
def _request_single_file( def _request_single_file(
self, model_repo: str, file_name: str, file_path: pathlib.Path self, model_repo: str, file_name: str, file_path: pathlib.Path
) -> bool: ) -> 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! # NOTE: Do not use bare exceptions! They mask issues!
# Allow the exception to occur or explicitly handle it. # Allow the exception to occur or explicitly handle it.
try: try: