2222
2323
2424class AbstractCheckpointManager (abc .ABC ):
25- """An interface that manages multiple Checkpointer classes.
25+ """An interface that manages multiple CheckpointHandler classes.
2626
2727 CheckpointManager coordinates save/restore operations across multiple
28- Checkpointer classes, and also provides useful methods describing checkpoint
28+ CheckpointHandler classes, and also provides useful methods describing
29+ checkpoint
2930 states.
3031
3132 For example, CheckpointManager may be responsible for managing a parameter
3233 state in the form of a PyTree and a dataset iterator state in the form of
3334 tf.data.Iterator.
3435
35- Each item should be handled by a separate Checkpointer .
36+ Each item should be handled by a separate CheckpointHandler .
3637
37- For instance, item "a" is handled by Checkpointer A, while item "b" is handled
38- by Checkpointer B.
38+ For instance, item "a" is handled by CheckpointHandler A, while item "b" is
39+ handled
40+ by CheckpointHandler B.
3941 """
4042
4143 @abc .abstractmethod
@@ -54,27 +56,28 @@ def save(
5456 ...
5557 }
5658 Each of these values is a saveable item that should be written with a
57- specific Checkpointer .
59+ specific CheckpointHandler .
5860
5961 Similarly, save_kwargs takes the form:
6062 {
6163 'params': {
62- <kwargs for PyTreeCheckpointer .save>
64+ <kwargs for PyTreeCheckpointHandler .save>
6365 },
6466 'dataset': {
65- <kwargs for DatasetCheckpointer .save>
67+ <kwargs for DatasetCheckpointHandler .save>
6668 }
6769 ...
6870 }
6971 The dict of kwargs for each key in save_kwargs is provided as extra
70- arguments to the save method of the corresponding Checkpointer .
72+ arguments to the save method of the corresponding CheckpointHandler .
7173
7274 Args:
7375 step: current step, int
7476 items: a savable object, or a dictionary of object name to savable object.
75- save_kwargs: save kwargs for a single Checkpointer, or a dictionary of
76- object name to kwargs needed by the Checkpointer implementation to save
77- the object.
77+ save_kwargs: save kwargs for a single CheckpointHandler, or a dictionary
78+ of object name to kwargs needed by the CheckpointHandler implementation
79+ to save the object.
80+
7881 Returns:
7982 bool indicating whether save was performed or not.
8083 """
@@ -97,29 +100,30 @@ def restore(
97100 ...
98101 }
99102 Each of these values is a restoreable item that should be read with a
100- specific Checkpointer. Implementations should support items=None, and the
103+ specific CheckpointHandler. Implementations should support items=None, and
104+ the
101105 ability to restore an item which is not provided in this dict.
102106
103107 Similarly, restore_kwargs takes the form:
104108 {
105109 'params': {
106- <kwargs for PyTreeCheckpointer .restore>
110+ <kwargs for PyTreeCheckpointHandler .restore>
107111 },
108112 'dataset': {
109- <kwargs for DatasetCheckpointer .restore>
113+ <kwargs for DatasetCheckpointHandler .restore>
110114 }
111115 ...
112116 }
113117 The dict of kwargs for each key in restore_kwargs is provided as extra
114- arguments to the restore method of the corresponding Checkpointer .
118+ arguments to the restore method of the corresponding CheckpointHandler .
115119
116120 Args:
117121 step: current step, int
118122 items: a restoreable object, or a dictionary of object name to restoreable
119123 object.
120- restore_kwargs: restore kwargs for a single Checkpointer , or a dictionary
121- of object name to kwargs needed by the Checkpointer implementation to
122- restore the object.
124+ restore_kwargs: restore kwargs for a single CheckpointHandler , or a
125+ dictionary of object name to kwargs needed by the CheckpointHandler
126+ implementation to restore the object.
123127
124128 Returns:
125129 A dictionary mapping name to restored object, or a single restored object.
@@ -128,13 +132,15 @@ def restore(
128132
129133 @abc .abstractmethod
130134 def structure (self ) -> Union [Any , Mapping [str , Any ]]:
131- """For all Checkpointers , returns the saved structure.
135+ """For all CheckpointHandlers , returns the saved structure.
132136
133- Calls the `structure` method for each Checkpointer and returns a mapping of
137+ Calls the `structure` method for each CheckpointHandler and returns a
138+ mapping of
134139 each item name to the restored structure. If the manager only manages a
135140 single item, a single structure will be returned instead.
136141
137- Note that any items for which the corresponding Checkpointer does not have
142+ Note that any items for which the corresponding CheckpointHandler does not
143+ have
138144 an implemented `structure` method, these items will simply not be contained
139145 in the result.
140146
0 commit comments