2020-02-23 02:45:34 +00:00
|
|
|
"""
|
|
|
|
Callbacks
|
|
|
|
=========
|
|
|
|
|
|
|
|
Callbacks supported by Lightning
|
|
|
|
"""
|
|
|
|
|
|
|
|
import abc
|
|
|
|
|
|
|
|
|
|
|
|
class Callback(abc.ABC):
|
|
|
|
"""Abstract base class used to build new callbacks."""
|
|
|
|
|
2020-02-27 22:21:51 +00:00
|
|
|
def on_init_start(self, trainer):
|
2020-02-26 04:17:27 +00:00
|
|
|
"""Called when the trainer initialization begins."""
|
2020-02-27 22:21:51 +00:00
|
|
|
pass
|
2020-02-26 04:17:27 +00:00
|
|
|
|
2020-02-27 22:21:51 +00:00
|
|
|
def on_init_end(self, trainer):
|
2020-02-26 04:17:27 +00:00
|
|
|
"""Called when the trainer initialization ends."""
|
|
|
|
pass
|
2020-02-23 02:45:34 +00:00
|
|
|
|
2020-02-26 04:17:27 +00:00
|
|
|
def on_fit_start(self, trainer, pl_module):
|
|
|
|
"""Called when the fit begins."""
|
|
|
|
pass
|
2020-02-23 02:45:34 +00:00
|
|
|
|
2020-02-26 04:17:27 +00:00
|
|
|
def on_fit_end(self, trainer, pl_module):
|
|
|
|
"""Called when the fit ends."""
|
|
|
|
pass
|
2020-02-23 02:45:34 +00:00
|
|
|
|
2020-02-26 04:17:27 +00:00
|
|
|
def on_epoch_start(self, trainer, pl_module):
|
2020-02-23 02:45:34 +00:00
|
|
|
"""Called when the epoch begins."""
|
|
|
|
pass
|
|
|
|
|
2020-02-26 04:17:27 +00:00
|
|
|
def on_epoch_end(self, trainer, pl_module):
|
2020-02-23 02:45:34 +00:00
|
|
|
"""Called when the epoch ends."""
|
|
|
|
pass
|
|
|
|
|
2020-02-26 04:17:27 +00:00
|
|
|
def on_batch_start(self, trainer, pl_module):
|
2020-02-23 02:45:34 +00:00
|
|
|
"""Called when the training batch begins."""
|
|
|
|
pass
|
|
|
|
|
2020-02-26 04:17:27 +00:00
|
|
|
def on_batch_end(self, trainer, pl_module):
|
2020-02-23 02:45:34 +00:00
|
|
|
"""Called when the training batch ends."""
|
|
|
|
pass
|
|
|
|
|
2020-02-26 04:17:27 +00:00
|
|
|
def on_train_start(self, trainer, pl_module):
|
2020-02-23 02:45:34 +00:00
|
|
|
"""Called when the train begins."""
|
|
|
|
pass
|
|
|
|
|
2020-02-26 04:17:27 +00:00
|
|
|
def on_train_end(self, trainer, pl_module):
|
2020-02-23 02:45:34 +00:00
|
|
|
"""Called when the train ends."""
|
|
|
|
pass
|
|
|
|
|
2020-02-26 04:17:27 +00:00
|
|
|
def on_validation_start(self, trainer, pl_module):
|
2020-02-23 02:45:34 +00:00
|
|
|
"""Called when the validation loop begins."""
|
|
|
|
pass
|
|
|
|
|
2020-02-26 04:17:27 +00:00
|
|
|
def on_validation_end(self, trainer, pl_module):
|
2020-02-23 02:45:34 +00:00
|
|
|
"""Called when the validation loop ends."""
|
|
|
|
pass
|
|
|
|
|
2020-02-26 04:17:27 +00:00
|
|
|
def on_test_start(self, trainer, pl_module):
|
2020-02-23 02:45:34 +00:00
|
|
|
"""Called when the test begins."""
|
|
|
|
pass
|
|
|
|
|
2020-02-26 04:17:27 +00:00
|
|
|
def on_test_end(self, trainer, pl_module):
|
2020-02-23 02:45:34 +00:00
|
|
|
"""Called when the test ends."""
|
|
|
|
pass
|