简体   繁体   English

flair import 在 mac ubuntu 和 google colab 上失败

[英]flair import failing on mac ubuntu and google colab

i am trying to use flair nlp framework,我正在尝试使用 flair nlp 框架,

https://github.com/flairNLP/flair https://github.com/flairNLP/flair

but getting error但出现错误

# load the NER tagger
tagger = SequenceTagger.load('ner')

tried on local, remote and other machine.在本地、远程和其他机器上试过。 all failing as its not able to download a model from s3.google colab also gives same error.全部失败,因为它无法从 s3.google colab 下载 model 也给出相同的错误。

all give error message as:都给出错误信息为:

OSError: HEAD request failed for url https://s3.eu-central-1.amazonaws.com/alan-nlp/resources/models-v0.4/NER-conll03-english/en-ner-conll03-v0.4.pt with status code 301.

. .

I was having the same issue, I don't know what happen with the link but I found another one.我遇到了同样的问题,我不知道链接会发生什么,但我找到了另一个。

You can look flair master repo https://github.com/flairNLP/flair/blob/master/flair/models/sequence_tagger_model.py on the def _fetch_model(model_name) line 971. There are using another path already "https://nlp.informatik.hu-berlin.de/resources/models", so they change to that path instead of alan-nlp.您可以在 def _fetch_model(model_name) 行 971 上查看 flair master repo https://github.com/flairNLP/flair/blob/master/flair/models/sequence_tagger_model.py 。已经使用另一个路径“https:// nlp.informatik.hu-berlin.de/resources/models”,因此他们更改为该路径而不是 alan-nlp。

So you can find your model here https://nlp.informatik.hu-berlin.de/resources/models/ner/所以你可以在这里找到你的模型https://nlp.informatik.hu-berlin.de/resources/models/ner/

I had a similar problem to this.我有一个类似的问题。

Note that flair now hosts the majority of their models on Huggingface .请注意, flair 现在Huggingface上托管了他们的大部分模型。

Most likely what you need to do is install the latest version of flair which has the sequence_tagger_model.py (and probably others) pointing to the right link.很可能您需要做的是安装最新版本的 flair,其中sequence_tagger_model.py (可能还有其他)指向正确的链接。

I had to uninstall flair, and then reinstall it:我不得不卸载 flair,然后重新安装它:

pip uninstall flair
pip install flair

to ensure it worked.以确保它有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM