0

我正在尝试将 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.
4

1 回答 1

0

这是一个非常旧的模型,较新的版本应该可以正常工作:https ://storage.googleapis.com/allennlp-public-models/biaffine-dependency-parser-ptb-2020.04.06.tar.gz

于 2020-12-18T17:46:08.183 回答