From 2ba8cf989ec9e451e1648ebac0e56ababda57ce8 Mon Sep 17 00:00:00 2001 From: Benedikt Fuchs Date: Fri, 24 Jun 2022 21:35:53 +0200 Subject: [PATCH] update hf-hub version --- flair/models/sequence_tagger_model.py | 14 +++++++------- requirements.txt | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/flair/models/sequence_tagger_model.py b/flair/models/sequence_tagger_model.py index 88c574a26..0053e7382 100644 --- a/flair/models/sequence_tagger_model.py +++ b/flair/models/sequence_tagger_model.py @@ -922,13 +922,13 @@ def _fetch_model(model_name) -> str: model_folder = model_name # Lazy import - from huggingface_hub import cached_download, hf_hub_url - - url = hf_hub_url(model_name, revision=revision, filename=hf_model_name) + from huggingface_hub.file_download import hf_hub_download try: - model_path = cached_download( - url=url, + model_path = hf_hub_download( + model_name, + hf_model_name, + revision=revision, library_name="flair", library_version=flair.__version__, cache_dir=flair.cache_root / "models" / model_folder, @@ -937,13 +937,13 @@ def _fetch_model(model_name) -> str: # output information log.error("-" * 80) log.error( - f"ACHTUNG: The key '{model_name}' was neither found on the ModelHub nor is this a valid path to a file on your system!" + f"ERROR: The key '{model_name}' was neither found on the ModelHub nor is this a valid path to a file on your system!" ) - # log.error(f" - Error message: {e}") log.error(" -> Please check https://huggingface.co/models?filter=flair for all available models.") log.error(" -> Alternatively, point to a model file on your local drive.") log.error("-" * 80) Path(flair.cache_root / "models" / model_folder).rmdir() # remove folder again if not valid + raise return model_path diff --git a/requirements.txt b/requirements.txt index 5cf9810fd..e9e75c71f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ sentencepiece==0.1.95 konoha<5.0.0,>=4.0.0 janome gdown==4.4.0 -huggingface-hub +huggingface-hub>=0.8.1 conllu>=4.0 more-itertools wikipedia-api