diff options
author | ZJaume <jzaragoza@prompsit.com> | 2022-09-30 12:07:23 +0300 |
---|---|---|
committer | ZJaume <jzaragoza@prompsit.com> | 2022-09-30 12:07:23 +0300 |
commit | cd3f128ddd41fa59b0d7ca9904bf4a5a98c1cbb5 (patch) | |
tree | 3d9759e9c991ef049602c5d7f66a25331cb547a9 | |
parent | 4c7cda25b4cfb41ac172bd5ca271ea2c8d2f7ff6 (diff) |
Update Hub client to 0.10
-rwxr-xr-x | bicleaner_ai/bicleaner_ai_classifier.py | 7 | ||||
-rw-r--r-- | requirements.txt | 1 |
2 files changed, 5 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: diff --git a/requirements.txt b/requirements.txt index cdc8bb7..560168a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,5 +12,6 @@ bicleaner-ai-glove==0.2.1 fuzzywuzzy python-Levenshtein transformers>=4.10.3,<5.0.0 +huggingface-hub>=0.10,<1.0 psutil regex |