@@ -212,31 +212,35 @@ def _attach_model_callbacks(self) -> None:
212
212
213
213
@staticmethod
214
214
def _reorder_callbacks (callbacks : list [Callback ]) -> list [Callback ]:
215
- """Moves all the tuner specific callbacks at the beginning of the list and all the `ModelCheckpoint` callbacks
216
- to the end of the list. The sequential order within the group of checkpoint callbacks is preserved, as well as
217
- the order of all other callbacks.
215
+ """Reorders a list of callbacks such that:
216
+
217
+ 1. All `tuner-specific` callbacks appear at the beginning.
218
+ 2. `ProgressBar` followed by `ModelCheckpoint` callbacks appear at the end.
219
+ 3. All other callbacks maintain their relative order.
218
220
219
221
Args:
220
- callbacks: A list of callbacks.
222
+ callbacks (list[Callback]): The list of callbacks to reorder .
221
223
222
224
Return:
223
- A new list in which the first elements are tuner specific callbacks and last elements are ModelCheckpoints
224
- if there were any present in the input.
225
+ list[Callback]: A new list with callbacks reordered as described above.
225
226
226
227
"""
227
228
tuner_callbacks : list [Callback ] = []
228
229
other_callbacks : list [Callback ] = []
230
+ progress_bar_callbacks : list [Callback ] = []
229
231
checkpoint_callbacks : list [Callback ] = []
230
232
231
233
for cb in callbacks :
232
234
if isinstance (cb , (BatchSizeFinder , LearningRateFinder )):
233
235
tuner_callbacks .append (cb )
234
236
elif isinstance (cb , Checkpoint ):
235
237
checkpoint_callbacks .append (cb )
238
+ elif isinstance (cb , ProgressBar ):
239
+ progress_bar_callbacks .append (cb )
236
240
else :
237
241
other_callbacks .append (cb )
238
242
239
- return tuner_callbacks + other_callbacks + checkpoint_callbacks
243
+ return tuner_callbacks + other_callbacks + progress_bar_callbacks + checkpoint_callbacks
240
244
241
245
242
246
def _validate_callbacks_list (callbacks : list [Callback ]) -> None :
0 commit comments