Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bitextor/bicleaner-ai.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZJaume <jzaragoza@prompsit.com>2022-09-30 12:07:23 +0300
committerZJaume <jzaragoza@prompsit.com>2022-09-30 12:07:23 +0300
commitcd3f128ddd41fa59b0d7ca9904bf4a5a98c1cbb5 (patch)
tree3d9759e9c991ef049602c5d7f66a25331cb547a9
parent4c7cda25b4cfb41ac172bd5ca271ea2c8d2f7ff6 (diff)
Update Hub client to 0.10
-rwxr-xr-xbicleaner_ai/bicleaner_ai_classifier.py7
-rw-r--r--requirements.txt1
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