Configs

class labml.configs.BaseConfigs[source]

You should sub-class this class to create your own configurations

labml.configs.option(name: Union[any, List[any]], *args: any)[source]

Use this as a decorator to register configuration options.

This has multiple overloads

labml.configs.option(config_item: Union[any, List[any]])[source]
labml.configs.option(config_item: Union[any, List[any]], option_name: str)[source]
labml.configs.option(config_item: Union[any, List[any]], pass_params: List[any])[source]
labml.configs.option(config_item: Union[any, List[any]], option_name: str, pass_params: List[any])[source]
Parameters
  • name – the configuration item or a list of items. If it is a list of items the function should return tuple.

  • option_name (str, optional) – name of the option. If not provided it will be derived from the function name.

  • pass_params (list, optional) – list of params to be passed. If not provided the configs object is passed. If provided the corresponding calculated configuration items will be passed to the function

labml.configs.calculate(name: any, *args: any)[source]

Use this to register configuration options.

This has multiple overloads

labml.configs.calculate(name: Union[any, List[any]], func: Callable)[source]
labml.configs.calculate(name: Union[any, List[any]], option_name: str, func: Callable)[source]
labml.configs.calculate(name: Union[any, List[any]], pass_params: List[any], func: Callable)[source]
labml.configs.calculate(name: Union[any, List[any]], option_name: str, pass_params: List[any], func: Callable)[source]
Parameters
  • name – the configuration item or a list of items. If it is a list of items the function should return tuple.

  • func – the function to calculate the configuration

  • option_name (str, optional) – name of the option. If not provided it will be derived from the function name.

  • pass_params (list, optional) – list of params to be passed. If not provided the configs object is passed. If provided the corresponding calculated configuration items will be passed to the function

labml.configs.hyperparams(*args: any, is_hyperparam=True)[source]

Identifies configuration as (or not) hyper-parameters

Parameters
  • *args – list of configurations

  • is_hyperparam (bool, optional) – whether the provided configuration items are hyper-parameters. Defaults to True.

labml.configs.aggregate(name: any, option_name: str, *args: Tuple[any, any])[source]

Aggregate configs

Parameters
  • name – name of the aggregate

  • option_name – aggregate option name

  • *args – list of configs to be aggregated