1
    archive = load_archive(
    "elmo-constituency-parser-2018.03.14.tar.gz"
)
predictor = Predictor.from_archive(archive, 'constituency-parser')

predictor.predict_json({"sentence": "This is a sentence to be predicted!"})

Loading the elmo-constituency-parser is thorwing this error: allennlp.common.checks.ConfigurationError: ptb_trees not in acceptable choices for

dataset_reader.type: ['babi', 'conll2003', 'interleaving', 'multitask', 'sequence_tagging', 'sharded', 'text_classification_json', 'multitask_shim']. 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.

Seems the load_archive func returnd a model name "ptb_trees" and a name containd "." was required, such as {"model": "my_module.models.MyModel"}

Any suggestion? Thanks!

River Hope
  • 11
  • 1
  • 1
    Try using `Predictor.from_path("elmo-constituency-parser-2018.03.14.tar.gz")` instead. The `from_path()` method automatically imports all "plugins" like allennlp-models where that reader is defined. – petew Oct 22 '21 at 22:20

0 Answers0