forked from Lightning-AI/pytorch-lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase.py
130 lines (96 loc) · 3.46 KB
/
base.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
r"""
Callback Base
-------------
Abstract base class used to build new callbacks.
"""
import abc
class Callback(abc.ABC):
r"""
Abstract base class used to build new callbacks.
"""
def setup(self, trainer, stage: str):
"""Called when fit or test begins"""
pass
def teardown(self, trainer, stage: str):
"""Called when fit or test ends"""
pass
def on_init_start(self, trainer):
"""Called when the trainer initialization begins, model has not yet been set."""
pass
def on_init_end(self, trainer):
"""Called when the trainer initialization ends, model has not yet been set."""
pass
def on_fit_start(self, trainer):
"""Called when fit begins"""
pass
def on_fit_end(self, trainer):
"""Called when fit ends"""
pass
def on_sanity_check_start(self, trainer, pl_module):
"""Called when the validation sanity check starts."""
pass
def on_sanity_check_end(self, trainer, pl_module):
"""Called when the validation sanity check ends."""
pass
def on_train_epoch_start(self, trainer, pl_module):
"""Called when the train epoch begins."""
pass
def on_train_epoch_end(self, trainer, pl_module):
"""Called when the train epoch ends."""
pass
def on_validation_epoch_start(self, trainer, pl_module):
"""Called when the val epoch begins."""
pass
def on_validation_epoch_end(self, trainer, pl_module):
"""Called when the val epoch ends."""
pass
def on_test_epoch_start(self, trainer, pl_module):
"""Called when the test epoch begins."""
pass
def on_test_epoch_end(self, trainer, pl_module):
"""Called when the test epoch ends."""
pass
def on_epoch_start(self, trainer, pl_module):
"""Called when the epoch begins."""
pass
def on_epoch_end(self, trainer, pl_module):
"""Called when the epoch ends."""
pass
def on_batch_start(self, trainer, pl_module):
"""Called when the training batch begins."""
pass
def on_validation_batch_start(self, trainer, pl_module):
"""Called when the validation batch begins."""
pass
def on_validation_batch_end(self, trainer, pl_module):
"""Called when the validation batch ends."""
pass
def on_test_batch_start(self, trainer, pl_module):
"""Called when the test batch begins."""
pass
def on_test_batch_end(self, trainer, pl_module):
"""Called when the test batch ends."""
pass
def on_batch_end(self, trainer, pl_module):
"""Called when the training batch ends."""
pass
def on_train_start(self, trainer, pl_module):
"""Called when the train begins."""
pass
def on_train_end(self, trainer, pl_module):
"""Called when the train ends."""
pass
def on_validation_start(self, trainer, pl_module):
"""Called when the validation loop begins."""
pass
def on_validation_end(self, trainer, pl_module):
"""Called when the validation loop ends."""
pass
def on_test_start(self, trainer, pl_module):
"""Called when the test begins."""
pass
def on_test_end(self, trainer, pl_module):
"""Called when the test ends."""
pass
def on_keyboard_interrupt(self, trainer, pl_module):
"""Called when the training is interrupted by KeyboardInterrupt."""