Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update hf-hub version #2837

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions flair/models/sequence_tagger_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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

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