@@ -22,6 +22,7 @@ def __init__(
22
22
self ._num_epochs_completed : int = num_epochs_completed
23
23
self ._num_steps_completed : int = num_steps_completed
24
24
self ._num_steps_completed_in_epoch : int = num_steps_completed_in_epoch
25
+ self ._num_steps_completed_in_prev_epoch : int = 0
25
26
26
27
@property
27
28
def num_epochs_completed (self ) -> int :
@@ -38,6 +39,11 @@ def num_steps_completed_in_epoch(self) -> int:
38
39
"""Number of steps completed thus far in epoch."""
39
40
return self ._num_steps_completed_in_epoch
40
41
42
+ @property
43
+ def num_steps_completed_in_prev_epoch (self ) -> int :
44
+ """Number of steps completed in the previous completed epoch."""
45
+ return self ._num_steps_completed_in_prev_epoch
46
+
41
47
def increment_step (self ) -> None :
42
48
"""Increment the step counts completed and completed within the epoch."""
43
49
self ._num_steps_completed += 1
@@ -46,6 +52,7 @@ def increment_step(self) -> None:
46
52
def increment_epoch (self ) -> None :
47
53
"""Increment the epochs completed and resets the steps completed within the epoch."""
48
54
self ._num_epochs_completed += 1
55
+ self ._num_steps_completed_in_prev_epoch = self ._num_steps_completed_in_epoch
49
56
self ._num_steps_completed_in_epoch = 0
50
57
51
58
def state_dict (self ) -> Dict [str , Any ]:
0 commit comments