neuralmonkey.config package¶
Submodules¶
neuralmonkey.config.builder module¶
Configuration Object Builder.
This module is responsible for instantiating objects specified by the experiment configuration.
-
class
neuralmonkey.config.builder.
ClassSymbol
(string: str) → None¶ Bases:
object
Represents a class (or other callable) in configuration.
-
create
() → typing.Any¶
-
-
class
neuralmonkey.config.builder.
ObjectRef
(expression: str) → None¶ Bases:
object
Represents a named object or its attribute in configuration.
-
bind
(value: typing.Any)¶
-
target
¶
-
-
neuralmonkey.config.builder.
build_config
(config_dicts: typing.Dict[str, typing.Any], ignore_names: typing.Set[str], warn_unused: bool = False) → typing.Dict[str, typing.Any]¶ Build the model from the configuration.
Parameters: - config_dicts – The parsed configuration file
- ignore_names – A set of names that should be ignored during the loading.
- warn_unused – Emit a warning if there are unused sections.
-
neuralmonkey.config.builder.
build_object
(value: str, all_dicts: typing.Dict[str, typing.Any], existing_objects: typing.Dict[str, typing.Any], depth: int) → typing.Any¶ Build an object from config dictionary of its arguments.
Works recursively.
Parameters: - value – Value that should be resolved (either a literal value or a config section name)
- all_dicts – Configuration dictionaries used to find configuration of unconstructed objects.
- existing_objects – Dictionary of already constructed objects.
- ignore_names – Set of names that shoud be ignored.
- depth – The current depth of recursion. Used to prevent an infinite
- recursion. –
-
neuralmonkey.config.builder.
instantiate_class
(name: str, all_dicts: typing.Dict[str, typing.Any], existing_objects: typing.Dict[str, typing.Any], depth: int) → typing.Any¶ Instantiate a class from the configuration.
Arguments: see help(build_object)
neuralmonkey.config.configuration module¶
-
class
neuralmonkey.config.configuration.
Configuration
¶ Bases:
object
Configuration loader.
Loads the configuration file in an analogical way the python’s argparse.ArgumentParser works.
-
add_argument
(name: str, required: bool = False, default: typing.Any = None, cond: typing.Callable[[typing.Any], bool] = None) → None¶
-
build_model
(warn_unused=False) → None¶
-
ignore_argument
(name: str) → None¶
-
load_file
(path: str, changes: typing.Union[typing.List[str], NoneType] = None) → None¶
-
make_namespace
(d_obj) → argparse.Namespace¶
-
save_file
(path: str) → None¶
-
neuralmonkey.config.exceptions module¶
Module that contains exceptions handled in config parsing and loading.
-
exception
neuralmonkey.config.exceptions.
ConfigBuildException
(object_name: str, original_exception: Exception) → None¶ Bases:
Exception
Exception caused by error in loading the model.
-
exception
neuralmonkey.config.exceptions.
ConfigInvalidValueException
(value: typing.Any, message: str) → None¶ Bases:
Exception
-
exception
neuralmonkey.config.exceptions.
IniError
(line: int, message: str, original_exc: typing.Union[Exception, NoneType] = None) → None¶ Bases:
Exception
Exception caused by error in INI file syntax.
neuralmonkey.config.parsing module¶
Module responsible for INI parsing.
-
neuralmonkey.config.parsing.
parse_file
(config_file: typing.Iterable[str], changes: typing.Union[typing.Iterable[str], NoneType] = None) → typing.Tuple[typing.Dict[str, typing.Any], typing.Dict[str, typing.Any]]¶ Parse an INI file and creates all values.
-
neuralmonkey.config.parsing.
write_file
(config_dict: typing.Dict[str, typing.Any], config_file: typing.IO[str]) → None¶
neuralmonkey.config.utils module¶
Utilities.
This module contains helper functions that are suppoosed to be called from the configuration file because calling the functions or the class constructors directly would be inconvinent or impossible.
-
neuralmonkey.config.utils.
adadelta_optimizer
(**kwargs) → tensorflow.python.training.adadelta.AdadeltaOptimizer¶
-
neuralmonkey.config.utils.
adam_optimizer
(learning_rate: float = 0.0001) → tensorflow.python.training.adam.AdamOptimizer¶
-
neuralmonkey.config.utils.
deprecated
(func: typing.Callable[..., T]) → typing.Callable[..., T]¶
-
neuralmonkey.config.utils.
variable
(initial_value=0, trainable: bool = False, **kwargs) → tensorflow.python.ops.variables.Variable¶