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 methodbuild_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 methodconvert_to_iter_based
, otherwise instance will be built by its constructor.registry (
Registry
) – ThePARAM_SCHEDULERS
registry.default_args (dict or ConfigDict or Config, optional) – Default initialization arguments. It must contain key
optimizer
. Ifconvert_to_iter_based
is defined incfg
, it must additionally contain keyepoch_length
. Defaults to None.
- Returns:
The constructed
ParamScheduler
.- Return type: