allenai / allennlp

An open-source NLP research library, built on PyTorch.
http://www.allennlp.org
Apache License 2.0
11.72k stars 2.25k forks source link

ConfigurationError: coref not in acceptable choices for dataset_reader.type: ['babi', 'conll2003', 'interleaving', 'multitask', 'multitask_shim', 'sequence_tagging', 'sharded', '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. #5657

Closed sreeshna closed 2 years ago

sreeshna commented 2 years ago

ConfigurationError Traceback (most recent call last) Input In [17], in <cell line: 2>() 1 model_url = 'https://storage.googleapis.com/allennlp-public-models/coref-spanbert-large-2020.02.27.tar.gz' ----> 2 predictor = Predictor.from_path(model_url)

File ~/anaconda3/lib/python3.9/site-packages/allennlp/predictors/predictor.py:366, in Predictor.from_path(cls, archive_path, predictor_name, cuda_device, dataset_reader_to_load, frozen, import_plugins, overrides, **kwargs) 363 if import_plugins: 364 plugins.import_plugins() 365 return Predictor.from_archive( --> 366 load_archive(archive_path, cuda_device=cuda_device, overrides=overrides), 367 predictor_name, 368 dataset_reader_to_load=dataset_reader_to_load, 369 frozen=frozen, 370 extra_args=kwargs, 371 )

File ~/anaconda3/lib/python3.9/site-packages/allennlp/models/archival.py:232, in load_archive(archive_file, cuda_device, overrides, weights_file) 229 config = Params.from_file(os.path.join(serialization_dir, CONFIG_NAME), overrides) 231 # Instantiate model and dataset readers. Use a duplicate of the config, as it will get consumed. --> 232 dataset_reader, validation_dataset_reader = _load_dataset_readers( 233 config.duplicate(), serialization_dir 234 ) 235 model = _load_model(config.duplicate(), weights_path, serialization_dir, cuda_device) 237 # Load meta.

File ~/anaconda3/lib/python3.9/site-packages/allennlp/models/archival.py:268, in _load_dataset_readers(config, serialization_dir) 262 # Try to use the validation dataset reader if there is one - otherwise fall back 263 # to the default dataset_reader used for both training and validation. 264 validation_dataset_reader_params = config.get( 265 "validation_dataset_reader", dataset_reader_params.duplicate() 266 ) --> 268 dataset_reader = DatasetReader.from_params( 269 dataset_reader_params, serialization_dir=serialization_dir 270 ) 271 validation_dataset_reader = DatasetReader.from_params( 272 validation_dataset_reader_params, serialization_dir=serialization_dir 273 ) 275 return dataset_reader, validation_dataset_reader

File ~/anaconda3/lib/python3.9/site-packages/allennlp/common/from_params.py:585, in FromParams.from_params(cls, params, constructor_to_call, constructor_to_inspect, **extras) 583 as_registrable = cast(Type[Registrable], cls) 584 default_to_first_choice = as_registrable.default_implementation is not None --> 585 choice = params.pop_choice( 586 "type", 587 choices=as_registrable.list_available(), 588 default_to_first_choice=default_to_first_choice, 589 ) 590 subclass, constructor_name = as_registrable.resolve_class_name(choice) 591 # See the docstring for an explanation of what's going on here.

File ~/anaconda3/lib/python3.9/site-packages/allennlp/common/params.py:324, in Params.pop_choice(self, key, choices, default_to_first_choice, allow_class_names) 317 key_str = self.history + key 318 message = ( 319 f"{value} not in acceptable choices for {key_str}: {choices}. " 320 "You should either use the --include-package flag to make sure the correct module " 321 "is loaded, or use a fully qualified class name in your config file like " 322 """{"model": "my_module.models.MyModel"} to have it imported automatically.""" 323 ) --> 324 raise ConfigurationError(message) 325 return value

ConfigurationError: coref not in acceptable choices for dataset_reader.type: ['babi', 'conll2003', 'interleaving', 'multitask', 'multitask_shim', 'sequence_tagging', 'sharded', '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.

AkshitaB commented 2 years ago

@sreeshna The coref dataset reader is defined in allennlp-models. Make sure that that's also installed.

github-actions[bot] commented 2 years ago

This issue is being closed due to lack of activity. If you think it still needs to be addressed, please comment on this thread 👇