Skip to content

Callback hook for on_after_optimizer_step #11688

Open
@tridao

Description

@tridao

🚀 Feature

A callback hook for on_after_optimizer_step.

Motivation

There's a callback hook for on_before_optimizer_step, but not for on_after_optimizer_step.
That would be useful for implementing an ExponentialMovingAverage callback: I'd like to update the average weights after the optimizer has updated the parameters. Doing this average weight update with on_train_batch_end hook will not be accurate, as the model weights may not get updated after every training batch (due to gradient accumulation).

cc @Borda @tchaton @rohitgr7 @carmocca @awaelchli @ninginthecloud @daniellepintz

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureIs an improvement or enhancementhooksRelated to the hooks APIpriority: 2Low priority task

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions