Allennlp: Release allennlp-semparse to pypi

Created on 5 Aug 2020  路  9Comments  路  Source: allenai/allennlp

Checklist

  • [x] I have verified that the issue exists against the master branch of AllenNLP.
  • [x] I have read the relevant section in the contribution guide on reporting bugs.
  • [x] I have checked the issues list for similar or identical bug reports.
  • [x] I have checked the pull requests list for existing proposed fixes.
  • [x] I have checked the CHANGELOG and the commit log to find out if the bug was already fixed in the master branch.
  • [x] I have included in the "Description" section below a traceback from any exceptions related to this bug.
  • [x] I have included in the "Related issues or possible duplicates" section beloew all related issues and possible duplicate issues (If there are none, check this box anyway).
  • [x] I have included in the "Environment" section below the name of the operating system and Python version that I was using when I discovered this bug.
  • [x] I have included in the "Environment" section below the output of pip freeze.
  • [x] I have included in the "Steps to reproduce" section below a minimally reproducible example.

Description


Tried all three URLs from the AllenNLP Public Models for the upgrade but none of them passes:

  • wikitables-model-2018.09.14.tar.gz
  • wikitables-model-2019.07.29.tar.gz
  • wikitables-model-2020.02.10.tar.gz

    Python traceback:

botml/service/serve.py:48: in make_app
    return make_app_helper(features, app, available_features)
botml/service/serve.py:56: in make_app_helper
    avail_features[feat](app)
botml/service/score_serve_mc.py:23: in add_api_mc
    predictor_qa = qa_tables.load_archive_from_model(model_path)
botml/nlp/qa_tables.py:12: in load_archive_from_model
    archive = load_archive(model_path)
allennlp/lib/python3.7/site-packages/allennlp/models/archival.py:197: in load_archive
    opt_level=opt_level,
allennlp/lib/python3.7/site-packages/allennlp/models/model.py:391: in load
    model_class: Type[Model] = cls.by_name(model_type)  # type: ignore
allennlp/lib/python3.7/site-packages/allennlp/common/registrable.py:137: in by_name
    subclass, constructor = cls.resolve_class_name(name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'allennlp.models.model.Model'>, name = 'wikitables_erm_parser'

    @classmethod
    def resolve_class_name(cls: Type[T], name: str) -> Tuple[Type[T], Optional[str]]:
        """
        Returns the subclass that corresponds to the given `name`, along with the name of the
        method that was registered as a constructor for that `name`, if any.

        This method also allows `name` to be a fully-specified module name, instead of a name that
        was already added to the `Registry`.  In that case, you cannot use a separate function as
        a constructor (as you need to call `cls.register()` in order to tell us what separate
        function to use).
        """
        if name in Registrable._registry[cls]:
            subclass, constructor = Registrable._registry[cls].get(name)
            return subclass, constructor
        elif "." in name:
            # This might be a fully qualified class name, so we'll try importing its "module"
            # and finding it there.
            parts = name.split(".")
            submodule = ".".join(parts[:-1])
            class_name = parts[-1]

            try:
                module = importlib.import_module(submodule)
            except ModuleNotFoundError:
                raise ConfigurationError(
                    f"tried to interpret {name} as a path to a class "
                    f"but unable to import module {submodule}"
                )

            try:
                subclass = getattr(module, class_name)
                constructor = None
                return subclass, constructor
            except AttributeError:
                raise ConfigurationError(
                    f"tried to interpret {name} as a path to a class "
                    f"but unable to find class {class_name} in {submodule}"
                )

        else:
            # is not a qualified class name
            raise ConfigurationError(
>               f"{name} is not a registered name for {cls.__name__}. "
                "You probably need to use the --include-package flag "
                "to load your custom code. Alternatively, you can specify your choices "
                """using fully-qualified paths, e.g. {"model": "my_module.models.MyModel"} """
                "in which case they will be automatically imported correctly."
            )
E           allennlp.common.checks.ConfigurationError: wikitables_erm_parser is not a registered name for Model. You probably need to use the --include-package flag to load your custom code. Alternatively, you can specify your choices using fully-qualified paths, e.g. {"model": "my_module.models.MyModel"} in which case they will be automatically imported correctly.

allennlp/lib/python3.7/site-packages/allennlp/common/registrable.py:185: ConfigurationError

Related issues or possible duplicates

  • None

Environment


OS: Ubuntu 18.04


Python version: 3.7.8


Output of pip freeze:


Steps to reproduce


Example source:


All 9 comments

That model is in the allennlp-semparse repo. You'll need to do pip install allennlp-semparse in order for that to work (though I'm not sure we have an up-to-date release; you may need to clone the repo and run pip install -e . instead...).

You may also have to explicitly import the model, to make sure it gets registered; I'm not sure if the semparse repo is included in our default set of plugins to check for.

You may also have to explicitly import the model, to make sure it gets registered; I'm not sure if the semparse repo is included in our default set of plugins to check for.

Hey @matt-gardner , Thanks for the quick response. pip install allennlp-semparse didn't work so I proceeded with pip install -e after cloning allennlp-semparse inside our repository. Then I built the package using the command python setup.py develop being inside the dir allennlp-semparse, but still I'm unable to import the semparse models explicitly into my codebase. Am I missing something? Also, why is the support for model wikitables_erm_parser removed from v1.0?

Screenshot from 2020-08-06 14-29-38
Added the following packages from allennlp-semparse and the error is gone! Thanks again @matt-gardner :smile:

That model is in the allennlp-semparse repo. You'll need to do pip install allennlp-semparse in order for that to work (though I'm not sure we have an up-to-date release; you may need to clone the repo and run pip install -e . instead...).

Hey @matt-gardner , do you guys have any plans to release allennlp-semparse to the pip? if not, how would you suggest we incorporate the same into our codebase?

Yes, we should be releasing this to pypi, we just haven't gotten to it yet. I'll rename and re-open this issue, so we don't forget about it, though it isn't super high priority for us. For now, you can just do pip install git+https://github.com/allenai/allennlp-semparse

@matt-gardner I can take this if you want. I'll ramp up the CI in the semparse repo to match what we've done with allennp-models CI.

Thanks, that'd be great.

allennlp-semparse is now on PyPI:

pip install allennlp-semparse
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ncammarata picture ncammarata  路  4Comments

onetonfoot picture onetonfoot  路  3Comments

epwalsh picture epwalsh  路  4Comments

MeiqiGuo picture MeiqiGuo  路  4Comments

Andy-jqa picture Andy-jqa  路  3Comments