vis4d.zoo.base.optimizer

Optimizer configuration.

Functions

get_lr_scheduler_cfg(scheduler[, begin, ...])

Default learning rate scheduler configuration.

get_optimizer_cfg(optimizer[, ...])

Default optimizer configuration.

get_lr_scheduler_cfg(scheduler, begin=0, end=-1, epoch_based=True, convert_epochs_to_steps=False, convert_attributes=None)[source]

Default learning rate scheduler configuration.

This creates a config object that can be initialized as a LearningRate scheduler for training.

Parameters:
  • scheduler (ConfigDict) – Learning rate scheduler configuration.

  • begin (int, optional) – Begin epoch. Defaults to 0.

  • end (int, optional) – End epoch. Defaults to None. Defaults to -1.

  • epoch_based (bool, optional) – Whether the learning rate scheduler is epoch based or step based. Defaults to True.

  • convert_epochs_to_steps (bool) – Whether to convert the begin and end for a step based scheduler to steps automatically based on length of train dataloader. Enables users to set the iteration breakpoints as epochs. Defaults to False.

  • convert_attributes (list[str] | None) – List of attributes in the scheduler that should be converted to steps. Defaults to None.

Returns:

Config dict that can be instantiated as LearningRate

scheduler.

Return type:

LrSchedulerConfig

get_optimizer_cfg(optimizer, lr_schedulers=None, param_groups=None)[source]

Default optimizer configuration.

This creates a config object that can be initialized as an Optimizer for training.

Parameters:
  • optimizer (ConfigDict) – Optimizer configuration.

  • lr_schedulers (list[LrSchedulerConfig] | None, optional) – Learning rate schedulers configuration. Defaults to None.

  • param_groups (list[ParamGroupCfg] | None, optional) – Parameter groups configuration. Defaults to None.

Returns:

Config dict that can be instantiated as Optimizer.

Return type:

OptimizerConfig