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

Error when running example from README: Invalid URL 'ner-fast' #164

Open
flackbash opened this issue Aug 27, 2024 · 2 comments
Open

Error when running example from README: Invalid URL 'ner-fast' #164

flackbash opened this issue Aug 27, 2024 · 2 comments

Comments

@flackbash
Copy link

I installed REL using pip and when running the minimal example from the README, I'm getting the following error:

/home/prangen/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py:671: FutureWarning: 'cached_download' is the legacy way to download files from the HF hub, please consider upgrading to 'hf_hub_download'
  warnings.warn(
2024-08-27 09:52:17,807 loading file /home/prangen/.flair/models/ner-english-fast/4c58e7191ff952c030b82db25b3694b58800b0e722ff15427f527e1631ed6142.d2c5731c75860f9743cc58e26828f6e0f447e3115da63d1ea50de876fde68cfe
2024-08-27 09:52:18,123 SequenceTagger predicts: Dictionary with 20 tags: <unk>, O, S-ORG, S-MISC, B-PER, E-PER, S-LOC, B-ORG, E-ORG, I-PER, S-PER, B-MISC, I-MISC, E-MISC, I-ORG, B-LOC, E-LOC, I-LOC, <START>, <STOP>
Traceback (most recent call last):
  File "/local/data/prangen/src/elevant/test_rel.py", line 14, in <module>
    tagger_ner = load_flair_ner("ner-fast")
  File "/home/prangen/.local/lib/python3.10/site-packages/REL/ner/flair_wrapper.py", line 12, in load_flair_ner
    return SequenceTagger.load(fetch_model(path_or_url, cache_root))
  File "/home/prangen/.local/lib/python3.10/site-packages/REL/utils.py", line 18, in fetch_model
    return get_from_cache(path_or_url, cache_dir)
  File "/home/prangen/.local/lib/python3.10/site-packages/flair/file_utils.py", line 216, in get_from_cache
    response = requests.head(url, headers={"User-Agent": "Flair"}, allow_redirects=True)
  File "/home/prangen/.local/lib/python3.10/site-packages/requests/api.py", line 100, in head
    return request("head", url, **kwargs)
  File "/home/prangen/.local/lib/python3.10/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/prangen/.local/lib/python3.10/site-packages/requests/sessions.py", line 575, in request
    prep = self.prepare_request(req)
  File "/home/prangen/.local/lib/python3.10/site-packages/requests/sessions.py", line 486, in prepare_request
    p.prepare(
  File "/home/prangen/.local/lib/python3.10/site-packages/requests/models.py", line 368, in prepare
    self.prepare_url(url, params)
  File "/home/prangen/.local/lib/python3.10/site-packages/requests/models.py", line 439, in prepare_url
    raise MissingSchema(
requests.exceptions.MissingSchema: Invalid URL 'ner-fast': No scheme supplied. Perhaps you meant https://ner-fast?

I have flair version 0.11.3 installed.

Any idea what might be the problem?

Thanks in advance!

@KDercksen
Copy link
Contributor

KDercksen commented Aug 27, 2024

Could you try this instead?

tagger_ner = load_flair_ner("flair/ner-english-fast")

@flackbash
Copy link
Author

Thank you for the quick reply!

I just tried this, but I get the same error (Invalid URL 'flair/ner-english-fast').
The same happens for just ner-english-fast.

It seems like the problem is only with flair version 0.11.x.
I just upgraded flair from 0.11.3 to 0.12.2 and the original code runs again without issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants