Skip to content

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

@flackbash

Description

@flackbash

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions