Shortcuts

mmengine.registry.build_scheduler_from_cfg

mmengine.registry.build_scheduler_from_cfg(cfg, registry, default_args=None)[source]

Builds a ParamScheduler instance from config.

ParamScheduler supports building instance by its constructor or method build_iter_from_epoch. Therefore, its registry needs a build function to handle both cases.

Parameters:
  • cfg (dict or ConfigDict or Config) – Config dictionary. If it contains the key convert_to_iter_based, instance will be built by method convert_to_iter_based, otherwise instance will be built by its constructor.

  • registry (Registry) – The PARAM_SCHEDULERS registry.

  • default_args (dict or ConfigDict or Config, optional) – Default initialization arguments. It must contain key optimizer. If convert_to_iter_based is defined in cfg, it must additionally contain key epoch_length. Defaults to None.

Returns:

The constructed ParamScheduler.

Return type:

object