Tools for programmatically generating config files for AllenNLP models.

class allennlp.common.configuration.Config(items: typing.List[allennlp.common.configuration.ConfigItem], typ3: str = None) → None[source]

Bases: typing.Generic

A Config represents an entire subdict in a configuration file. If it corresponds to a named subclass of a registrable class, it will also contain a type item in addition to whatever items are required by the subclass from_params method.

to_json() → typing.Dict[str, typing.Any][source]
class allennlp.common.configuration.ConfigItem[source]

Bases: tuple

Each ConfigItem represents a single entry in a configuration JsonDict.


Alias for field number 1


Alias for field number 3


Alias for field number 2


Alias for field number 0

to_json() → typing.Dict[str, typing.Any][source]
allennlp.common.configuration.choices(full_path: str = '') → typing.List[str][source]
allennlp.common.configuration.configure(full_path: str = '') → allennlp.common.configuration.Config[source]
allennlp.common.configuration.full_name(cla55: typing.Union[type, NoneType]) → str[source]

Return the full name (including module) of the given class.

allennlp.common.configuration.is_configurable(typ3: type) → bool[source]
allennlp.common.configuration.is_registrable(typ3: type) → bool[source]
allennlp.common.configuration.json_annotation(cla55: typing.Union[type, NoneType])[source]
allennlp.common.configuration.render_config(config: allennlp.common.configuration.Config, indent: str = '') → str[source]

Pretty-print a config in sort-of-JSON+comments.