【发布时间】:2021-03-23 19:40:13
【问题描述】:
我正在尝试将 allennlp 预测器用于 biaffine 解析器。这是代码:-
from allennlp.predictors.predictor import Predictor
predictor = Predictor.from_path("https://s3-us-west-2.amazonaws.com/allennlp/models/biaffine-dependency-parser-ptb-2018.08.23.tar.gz")
但是,我得到了这个错误:-
ConfigurationError Traceback (most recent call last)
<ipython-input-3-74e2bcfcbf43> in <module>()
1 from allennlp.predictors.predictor import Predictor
----> 2 predictor = Predictor.from_path("https://s3-us-west-2.amazonaws.com/allennlp/models/biaffine-dependency-parser-ptb-2018.08.23.tar.gz")
4 frames
/usr/local/lib/python3.6/dist-packages/allennlp/common/params.py in pop_choice(self, key, choices, default_to_first_choice, allow_class_names)
350 """{"model": "my_module.models.MyModel"} to have it imported automatically."""
351 )
--> 352 raise ConfigurationError(message)
353 return value
354
ConfigurationError: universal_dependencies not in acceptable choices for dataset_reader.type: ['conll2003', 'interleaving', 'sequence_tagging', 'sharded', 'babi', 'text_classification_json']. You should either use the --include-package flag to make sure the correct module is loaded, or use a fully qualified class name in your config file like {"model": "my_module.models.MyModel"} to have it imported automatically.
【问题讨论】:
-
您在哪里找到该模型的链接?我只是好奇,因为它太旧了。
-
@petew ,只是试图复制研究论文的一些结果。他们在代码中使用了旧版本的解析器。
-
明白了。在这种情况下,如果你真的需要使用那个精确的模型,你将不得不使用旧版本的 AllenNLP。不幸的是,我不能告诉你哪个版本会在我脑海中发挥作用。但是 v0.9.0 可能是一个不错的起点。
标签: nlp pytorch dependency-parsing allennlp