mirror of https://github.com/hpcaitech/ColossalAI
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.2 KiB
66 lines
1.2 KiB
from abc import ABC
|
|
|
|
from coati.experience_maker import Experience
|
|
|
|
|
|
class TrainerCallback(ABC):
|
|
"""
|
|
Base callback class. It defines the interface for callbacks.
|
|
"""
|
|
|
|
def on_fit_start(self) -> None:
|
|
pass
|
|
|
|
def on_fit_end(self) -> None:
|
|
pass
|
|
|
|
def on_episode_start(self, episode: int) -> None:
|
|
pass
|
|
|
|
def on_episode_end(self, episode: int) -> None:
|
|
pass
|
|
|
|
def on_epoch_start(self, epoch: int) -> None:
|
|
pass
|
|
|
|
def on_epoch_end(self, epoch: int) -> None:
|
|
pass
|
|
|
|
def on_batch_start(self) -> None:
|
|
pass
|
|
|
|
def on_batch_end(self, metrics: dict, experience: Experience) -> None:
|
|
pass
|
|
|
|
def on_update_start(self) -> None:
|
|
pass
|
|
|
|
def on_update_end(self) -> None:
|
|
pass
|
|
|
|
|
|
class MakerCallback(ABC):
|
|
def on_loop_start(self) -> None:
|
|
pass
|
|
|
|
def on_loop_end(self) -> None:
|
|
pass
|
|
|
|
def on_make_experience_start(self) -> None:
|
|
pass
|
|
|
|
def on_make_experience_end(self, experience: Experience) -> None:
|
|
pass
|
|
|
|
def on_send_start(self) -> None:
|
|
pass
|
|
|
|
def on_send_end(self) -> None:
|
|
pass
|
|
|
|
def on_batch_start(self) -> None:
|
|
pass
|
|
|
|
def on_batch_end(self) -> None:
|
|
pass
|