allennlp.common.configuration

Tools for programmatically generating config files for AllenNLP models.

class allennlp.common.configuration.Config(items: List[allennlp.common.configuration.ConfigItem], typ3: str = 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(self) → Dict[str, Any][source]
class allennlp.common.configuration.ConfigItem[source]

Bases: tuple

Each ConfigItem represents a single entry in a configuration JsonDict.

property annotation

Alias for field number 1

property comment

Alias for field number 3

property default_value

Alias for field number 2

property name

Alias for field number 0

to_json(self) → Dict[str, Any][source]
allennlp.common.configuration.choices(full_path: str = '') → List[str][source]
allennlp.common.configuration.configure(full_path: str = '') → allennlp.common.configuration.Config[source]
allennlp.common.configuration.full_name(cla55: 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: 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.