These submodules contain the command line tools for things like training and evaluating models. You probably don’t want to call most of them directly. Instead, just create a script that calls allennlp.commands.main() and it will automatically inherit all of the subcommands in this module.

The included module is such a script:

Run AllenNLP

optional arguments:
  -h, --help  show this help message and exit

    train       Train a model
    configure   Generate a stub configuration
    evaluate    Evaluate the specified model + dataset
    predict     Use a trained model to make predictions.
    make-vocab  Create a vocabulary
    elmo        Use a trained model to make predictions.
    fine-tune   Continue training a model on a new dataset
    dry-run     Create a vocabulary, compute dataset statistics and other
                training utilities.
                Run the unit tests.

However, it only knows about the models and classes that are included with AllenNLP. Once you start creating custom models, you’ll need to make your own script which imports them and then calls main().

allennlp.commands.main(prog: str = None, subcommand_overrides: typing.Dict[str, allennlp.commands.subcommand.Subcommand] = {}) → None[source]

The run command only knows about the registered classes in the allennlp codebase. In particular, once you start creating your own Model s and so forth, it won’t work for them, unless you use the --include-package flag.