Configs¶
Here is a tutorial on Google Colab that shows how to use the configs module
-
class
labml.configs.
BaseConfigs
(*, _primary: str = None)[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.
meta_config
(*args: any, is_meta=True)[source]¶ Identifies configuration as meta parameter
- Parameters
*args – list of configurations
is_meta (bool, optional) – whether the provided configuration items are meta. 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
Dynamic Hyper-parameters¶
-
class
labml.configs.
DynamicHyperParam
(default: Union[float, int], type_: str, range_: Tuple[float, float])[source]¶ Dynamic hyper-parameters can be changed manually on labml.ai app <https://labml.ai> while the models are training. There are designed as an alternative to hyper-parameter schedules like gradually decreasing learning rate as the training progresses. Dynamic hyper-parameters let users change the values based on training metrics instead of sticking to a pre-determined schedule.
This is the base class that is extended by specific dynamic hyper-parameter types. You should use those.