refactor: rename optimizer step callback hooks to before and after
- rename on_optimizer_step to before_optimizer_step across the callback protocol, built-in callbacks, and trainer call site - rename on_after_optimizer_step to after_optimizer_step for the symmetric post-step hook - document the hook pair and the checkpoint save location in developer and training guides
This commit is contained in:
@@ -93,7 +93,7 @@ class Trainer:
|
||||
self._call_callbacks("on_batch_end", context)
|
||||
|
||||
if executor.sync_gradients:
|
||||
self._call_callbacks("on_optimizer_step", context)
|
||||
self._call_callbacks("before_optimizer_step", context)
|
||||
context.optimizer.step()
|
||||
context.strategy.on_optimizer_step()
|
||||
context.optimizer.zero_grad()
|
||||
@@ -101,7 +101,7 @@ class Trainer:
|
||||
if context.scheduler:
|
||||
context.scheduler.step()
|
||||
|
||||
self._call_callbacks("on_after_optimizer_step", context)
|
||||
self._call_callbacks("after_optimizer_step", context)
|
||||
|
||||
self._call_callbacks("on_epoch_end", context)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user