mmagic.engine.hooks.reduce_lr_scheduler_hook
¶
Module Contents¶
Classes¶
A hook to update learning rate. |
Attributes¶
- class mmagic.engine.hooks.reduce_lr_scheduler_hook.ReduceLRSchedulerHook(val_metric: str = None, by_epoch=True, interval=1)[source]¶
Bases:
mmengine.hooks.ParamSchedulerHook
A hook to update learning rate.
- Parameters
val_metric (str) – The metric of validation. If val_metric is not None, we check val_metric to reduce learning. Default: None.
by_epoch (bool) – Whether to update by epoch. Default: True.
interval (int) – The interval of iterations to update. Default: 1.
- after_train_epoch(runner: mmengine.runner.Runner)[source]¶
Call step function for each scheduler after each train epoch.
- Parameters
runner (Runner) – The runner of the training process.
- after_train_iter(runner: mmengine.runner.Runner, batch_idx: int, data_batch: DATA_BATCH = None, outputs: Optional[dict] = None) None [source]¶
Call step function for each scheduler after each 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 (Sequence[dict], optional) – Data from dataloader. In order to keep this interface consistent with other hooks, we keep
data_batch
here. Defaults to None.outputs (dict, optional) – Outputs from model. In order to keep this interface consistent with other hooks, we keep
data_batch
here. Defaults to None.