@@ -188,7 +188,6 @@ def __init__(
188188 auto_insert_metric_name : bool = True ,
189189 every_n_train_steps : Optional [int ] = None ,
190190 every_n_val_epochs : Optional [int ] = None ,
191- save_on_train_end : bool = False ,
192191 period : Optional [int ] = None ,
193192 ):
194193 super ().__init__ ()
@@ -205,7 +204,6 @@ def __init__(
205204 self .best_model_score = None
206205 self .best_model_path = ""
207206 self .last_model_path = ""
208- self ._save_on_train_end = save_on_train_end
209207
210208 self .__init_monitor_mode (monitor , mode )
211209 self .__init_ckpt_dir (dirpath , filename , save_top_k )
@@ -242,33 +240,6 @@ def on_validation_end(self, trainer, pl_module) -> None:
242240 return
243241 self .save_checkpoint (trainer )
244242
245- def on_train_end (self , trainer , pl_module ) -> None :
246- """Save a checkpoint at the very end of training.
247-
248- This will only save a checkpoint if `save_last` is also enabled
249- as the monitor metrics produced by training or validation steps or end of epochs
250- is not guaranteed to be available at this stage.
251- """
252- if self ._should_skip_saving_checkpoint (trainer ) or not trainer .checkpoint_connector .has_trained :
253- return
254-
255- initial_save_last = self .save_last
256- if self ._save_on_train_end and not self .save_last :
257- rank_zero_warn (
258- "Requested to save a checkpoint at the end of training but save_last is not set. Temporarily setting save_last=True to save."
259- )
260- self .save_last = True
261- if self .verbose :
262- rank_zero_info ("Saving last checkpoint..." )
263-
264- # as we advance one step at end of training, we use global_step - 1
265- # to avoid saving duplicates
266- trainer .global_step -= 1
267- monitor_candidates = self ._monitor_candidates (trainer )
268- self ._save_last_checkpoint (trainer , monitor_candidates )
269- trainer .global_step += 1
270- self .save_last = initial_save_last
271-
272243 def on_save_checkpoint (self , trainer , pl_module , checkpoint : Dict [str , Any ]) -> Dict [str , Any ]:
273244 return {
274245 "monitor" : self .monitor ,
0 commit comments