# Buggy code
def from_path(
    cls,
    archive_path: str,
    predictor_name: str = None,
    cuda_device: int = -1,
    dataset_reader_to_load: str = "validation",
    frozen: bool = True,
) -> "Predictor":
    """
    Instantiate a `Predictor` from an archive path.

    If you need more detailed configuration options, such as overrides,
    please use `from_archive`.

    # Parameters

    archive_path : `str`
        The path to the archive.
    predictor_name : `str`, optional (default=`None`)
        Name that the predictor is registered as, or None to use the
        predictor associated with the model.
    cuda_device : `int`, optional (default=`-1`)
        If `cuda_device` is >= 0, the model will be loaded onto the
        corresponding GPU. Otherwise it will be loaded onto the CPU.
    dataset_reader_to_load : `str`, optional (default=`"validation"`)
        Which dataset reader to load from the archive, either "train" or
        "validation".
    frozen : `bool`, optional (default=`True`)
        If we should call `model.eval()` when building the predictor.

    # Returns

    `Predictor`
        A Predictor instance.
    """
    return Predictor.from_archive(
        load_archive(archive_path, cuda_device=cuda_device),
        predictor_name,
        dataset_reader_to_load=dataset_reader_to_load,
        frozen=frozen,
    )


# Traceback (ConfigurationError)
---------------------------------------------------------------------------
---------------------------------------------------------------------------
ConfigurationError                        Traceback (most recent call last)
<ipython-input-56-91de5da48e5e> in <module>()
10 from allennlp.predictors.predictor import Predictor
11 get_ipython().system('pip install swifter')
---> 12 predictor = Predictor.from_path("/content/allenepi/model.tar.gz")
13 labels_dict = predictor._model.vocab.get_index_to_token_vocabulary('labels')
14
3 frames
/usr/local/lib/python3.6/dist-packages/allennlp/predictors/predictor.py
in from_path(cls, archive_path, predictor_name, cuda_device, dataset_reader_to_load, frozen)
257             predictor_name,
258             dataset_reader_to_load=dataset_reader_to_load,
--> 259             frozen=frozen,
260         )
261
/usr/local/lib/python3.6/dist-packages/allennlp/predictors/predictor.py in from_archive(cls, archive, predictor_name, dataset_reader_to_load, frozen)
292         else:
293             dataset_reader_params = config["dataset_reader"]
--> 294         dataset_reader = DatasetReader.from_params(dataset_reader_params)
295
296         model = archive.model
/usr/local/lib/python3.6/dist-packages/allennlp/common/from_params.py in from_params(cls, params, constructor_to_call, constructor_to_inspect, **extras)
558                 "type",
559                 choices=as_registrable.list_available(),
--> 560                 default_to_first_choice=default_to_first_choice,
561             )
562             subclass, constructor_name = as_registrable.resolve_class_name(choice)
/usr/local/lib/python3.6/dist-packages/allennlp/common/params.py in pop_choice(self, key, choices, default_to_first_choice, allow_class_names)
349                 """{"model": "my_module.models.MyModel"} to have it imported automatically."""
350             )
--> 351             raise ConfigurationError(message)
352         return value
353
ConfigurationError: snli 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.```

# Fixed code
def from_path(
    cls,
    archive_path: str,
    predictor_name: str = None,
    cuda_device: int = -1,
    dataset_reader_to_load: str = "validation",
    frozen: bool = True,
    import_plugins: bool = True,
) -> "Predictor":
    """
    Instantiate a `Predictor` from an archive path.

    If you need more detailed configuration options, such as overrides,
    please use `from_archive`.

    # Parameters

    archive_path : `str`
        The path to the archive.
    predictor_name : `str`, optional (default=`None`)
        Name that the predictor is registered as, or None to use the
        predictor associated with the model.
    cuda_device : `int`, optional (default=`-1`)
        If `cuda_device` is >= 0, the model will be loaded onto the
        corresponding GPU. Otherwise it will be loaded onto the CPU.
    dataset_reader_to_load : `str`, optional (default=`"validation"`)
        Which dataset reader to load from the archive, either "train" or
        "validation".
    frozen : `bool`, optional (default=`True`)
        If we should call `model.eval()` when building the predictor.
    import_plugins : `bool`, optional (default=`True`)
        If `True`, we attempt to import plugins before loading the predictor.
        This comes with additional overhead, but means you don't need to explicitly
        import the modules that your predictor depends on as long as those modules
        can be found by `allennlp.common.plugins.import_plugins()`.

    # Returns

    `Predictor`
        A Predictor instance.
    """
    if import_plugins:
        plugins.import_plugins()
    return Predictor.from_archive(
        load_archive(archive_path, cuda_device=cuda_device),
        predictor_name,
        dataset_reader_to_load=dataset_reader_to_load,
        frozen=frozen,
    )