diff options
Diffstat (limited to 'bicleaner_ai/bicleaner_ai_classifier.py')
-rwxr-xr-x | bicleaner_ai/bicleaner_ai_classifier.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bicleaner_ai/bicleaner_ai_classifier.py b/bicleaner_ai/bicleaner_ai_classifier.py index ea11824..2f53b6c 100755 --- a/bicleaner_ai/bicleaner_ai_classifier.py +++ b/bicleaner_ai/bicleaner_ai_classifier.py @@ -51,14 +51,15 @@ def initialization(argv = None): # Try to download the model if not a valid path hub_not_found = False - if not args.offline: + if not args.offline and not os.path.exists(args.model): + logging.info("Model path does not exist, looking in HuggingFace...") from huggingface_hub import snapshot_download, model_info - from huggingface_hub.utils import RepositoryNotFoundError + from huggingface_hub.utils import RepositoryNotFoundError, HFValidationError from requests.exceptions import HTTPError try: # Check if it exists at the HF Hub model_info(args.model, token=args.auth_token) - except (RepositoryNotFoundError, HTTPError): + except (RepositoryNotFoundError, HTTPError, HFValidationError): hub_not_found = True args.metadata = args.model + '/metadata.yaml' else: |