flairNLP / flair

A very simple framework for state-of-the-art Natural Language Processing (NLP)
https://flairnlp.github.io/flair/
Other
13.88k stars 2.1k forks source link

Example Usage Error! #995

Closed Nicozwy closed 4 years ago

Nicozwy commented 5 years ago

Hi, I am new to this, what should I do to solve the ConnectionError when run the example usage.

load the NER tagger

tagger = SequenceTagger.load('ner')

Traceback is as following, what should I do?

Traceback (most recent call last): File "", line 1, in File "/home/usr/anaconda3/envs/flair/lib/python3.6/site-packages/flair/usr/sequence_tagger_model.py", line 413, in load model_file = cached_path(base_path, cache_dir='models') File "/home/usr/anaconda3/envs/flair/lib/python3.6/site-packages/flair/file_utils.py", line 72, in cached_path return get_from_cache(url_or_filename, dataset_cache) File "/home/usr/anaconda3/envs/flair/lib/python3.6/site-packages/flair/file_utils.py", line 100, in get_from_cache response = requests.head(url) File "/home/usr/anaconda3/envs/flair/lib/python3.6/site-packages/requests/api.py", line 101, in head return request('head', url, kwargs) File "/home/usr/anaconda3/envs/flair/lib/python3.6/site-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, kwargs) File "/home/usr/anaconda3/envs/flair/lib/python3.6/site-packages/requests/sessions.py", line 533, in request resp = self.send(prep, send_kwargs) File "/home/usr/anaconda3/envs/flair/lib/python3.6/site-packages/requests/sessions.py", line 646, in send r = adapter.send(request, kwargs) File "/home/usr/anaconda3/envs/flair/lib/python3.6/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='s3.eu-central-1.amazonaws.com', port=443): Max retries exceeded with url: /alan-nlp/resources/models-v0.2/NER-conll03--h256-l1-b32-%2Bglove%2Bnews-forward%2Bnews-backward--v0.2/en-ner-conll03-v0.2.pt (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f0e0a140668>: Failed to establish a new connection: [Errno 110] Connection timed out',))

alanakbik commented 5 years ago

You can try downloading the model directly here: https://alan-nlp.s3.eu-central-1.amazonaws.com/resources/models-v0.2/NER-conll03--h256-l1-b32-%2Bglove%2Bnews-forward%2Bnews-backward--v0.2/en-ner-conll03-v0.2.pt

Unfortunately, we don't understand why some users cannot download the models directly through the code. One user mentioned that their network is somehow blocking access to AWS. If anybody has an idea what we could do from our side, we'd be very grateful.

Nicozwy commented 5 years ago

Thank you! I can download the model from the link. By the way, if I want to evaluate the Context String Embedding model on my datasets, what should I do?

alanakbik commented 5 years ago

My advice in this case is to use the current version of Flair and use the current 'ner' model (version 0.4). This model was trained with the parameters in the Contextual String Embeddings paper, so then you can directly use it.

If you want to train your own model, the training parameters are listed in https://github.com/zalandoresearch/flair/blob/master/resources/docs/EXPERIMENTS.md

XiaoqingNLP commented 4 years ago

@alanakbik Hi, I can't access the link you gave, either in the code or in the browser.

You can try downloading the model directly here: https://alan-nlp.s3.eu-central-1.amazonaws.com/resources/models-v0.2/NER-conll03--h256-l1-b32-%2Bglove%2Bnews-forward%2Bnews-backward--v0.2/en-ner-conll03-v0.2.pt

Unfortunately, we don't understand why some users cannot download the models directly through the code. One user mentioned that their network is somehow blocking access to AWS. If anybody has an idea what we could do from our side, we'd be very grateful.

alanakbik commented 4 years ago

@PlayDeep could it be that your network is somehow blocking access? Unfortunately we cannot reproduce this error on our side so any help debugging this would be greatly appreciated.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.