AllenNLP 在 "to be" 个句子上失败。一路上有东西坏了

AllenNLP fails on "to be" sentences. Something Broke along the Way

涉及动词“is”的简单句子return 没有通过演示页面或使用 AllenNLP in Python3.8 和最新的 November Bert 基础模型进行语义角色标记的结果.

例如,“我在这里。” return没什么。

简而言之:

这用于早期版本:

allennlp==1.0.0
allennlp-models==1.0.0

相关问题或可能的重复问题

环境

OS: macOS 10.15.7 (卡特琳娜)

Python 版本:3.8.6(通过自制软件)

allennlp==1.2.2
allennlp-models==1.2.2
attrs==20.3.0
blis==0.4.1
boto3==1.16.24
botocore==1.19.24
catalogue==1.0.0
certifi==2020.11.8
chardet==3.0.4
click==7.1.2
conllu==4.2.1
cymem==2.0.4
dataclasses==0.6
filelock==3.0.12
ftfy==5.8
future==0.18.2
h5py==3.1.0
idna==2.10
importlib-metadata==3.1.0
iniconfig==1.1.1
jmespath==0.10.0
joblib==0.17.0
jsonnet==0.17.0
jsonpickle==1.4.1
murmurhash==1.0.4
nltk==3.5
numpy==1.19.4
overrides==3.1.0
packaging==20.4
plac==1.1.3
pluggy==0.13.1
preshed==3.0.4
protobuf==3.14.0
py==1.9.0
py-rouge==1.1
pyparsing==2.4.7
pytest==6.1.2
python-dateutil==2.8.1
regex==2020.11.13
requests==2.25.0
s3transfer==0.3.3
sacremoses==0.0.43
scikit-learn==0.23.2
scipy==1.5.4
sentencepiece==0.1.91
six==1.15.0
spacy==2.3.2
srsly==1.0.4
tensorboardX==2.1
thinc==7.4.1
threadpoolctl==2.1.0
tokenizers==0.9.3
toml==0.10.2
torch==1.7.0
tqdm==4.53.0
transformers==3.5.1
typing-extensions==3.7.4.3
urllib3==1.26.2
wasabi==0.8.0
wcwidth==0.2.5
word2number==1.1
zipp==3.4.0

重现步骤

Visit the demo website for SRL

示例:

输入几乎任何变体: “我在这里。” “我们是人。” “我是。”

#  https://demo.allennlp.org/semantic-role-labeling/MjU3NDk3NA==

# or
from allennlp.predictors.predictor import Predictor

allen_predictor_srl = Predictor.from_path(
    "./models/bert-base-srl-2020.11.19.tar.gz"
)

output = allen_predictor_srl.predict(sentence="I am here.")
print(output)

# observe nothing

编辑: 我尝试安装我曾经拥有的确切库版本(即 AllenNLP 1.0),但问题仍然存在。坦率地说,我不知道发生了什么。

编辑 2:

安装脚本:

python3 -m venv env
source ./env/bin/activate


pip3 install --upgrade pip

pip3 install -U --no-cache-dir

pip3 install -U allennlp allennlp-models --no-cache-dir

python3 -m spacy download en_core_web_lg    --no-cache-dir
python3 -m spacy download en_core_web_sm    --no-cache-dir
python3 -m spacy download en_vectors_web_lg --no-cache-dir
python3 -m spacy download de_core_news_md   --no-cache-dir

为了提供一些关闭,问题是由 Spacy 中的更新引起的。我们在 https://github.com/allenai/allennlp-models/pull/178 (thank you https://github.com/wangrat) 中有一个修复,它将在 AllenNLP 1.3 中正式发布。

如果您更早需要此功能,我们建议您查看 AllenNLP 的 main 分支并使用 pip install -e ..

安装它