Skip to content

Commit

Permalink
update hf-hub version
Browse files Browse the repository at this point in the history
  • Loading branch information
helpmefindaname committed Jun 24, 2022
1 parent 3ba253c commit 61a97b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions flair/models/sequence_tagger_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,13 +916,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,
Expand All @@ -931,13 +931,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

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 61a97b8

Please sign in to comment.