Shortcuts

ParamSchedulerHook

class mmengine.hooks.ParamSchedulerHook[source]

A hook to update some hyper-parameters in optimizer, e.g., learning rate and momentum.

after_train_epoch(runner)[source]

Call step function for each scheduler after each training epoch.

Parameters:

runner (Runner) – The runner of the training process.

Return type:

None

after_train_iter(runner, batch_idx, data_batch=None, outputs=None)[source]

Call step function for each scheduler after each training iteration.

Parameters:
  • runner (Runner) – The runner of the training process.

  • batch_idx (int) – The index of the current batch in the train loop.

  • data_batch (dict or tuple or list, optional) – Data from dataloader. In order to keep this interface consistent with other hooks, we keep data_batch here.

  • outputs (dict, optional) – Outputs from model. In order to keep this interface consistent with other hooks, we keep data_batch here.

Return type:

None

after_val_epoch(runner, metrics=None)[source]

Call step function for each scheduler which has attribute need_val_args after each validation epoch.

Parameters:
  • runner (Runner) – The runner of the validation process.

  • metrics (Dict[str, float], optional) – Evaluation results of all metrics on validation dataset. The keys are the names of the metrics, and the values are corresponding results.

Return type:

None

Note

if runner.param_schedulers is not built before, the hook after_val_epoch will be skipped.