@@ -197,10 +197,10 @@ def on_train_batch_start(self, trainer, pl_module, batch, batch_idx):
197
197
def on_train_batch_end (self , trainer , pl_module , outputs , batch , batch_idx ):
198
198
self ._on_batch_end ("train_step_timing" , pl_module )
199
199
200
- def on_validation_batch_start (self , trainer , pl_module , batch , batch_idx , dataloader_idx ):
200
+ def on_validation_batch_start (self , trainer , pl_module , batch , batch_idx , dataloader_idx = 0 ):
201
201
self ._on_batch_start ("validation_step_timing" )
202
202
203
- def on_validation_batch_end (self , trainer , pl_module , outputs , batch , batch_idx , dataloader_idx ):
203
+ def on_validation_batch_end (self , trainer , pl_module , outputs , batch , batch_idx , dataloader_idx = 0 ):
204
204
self ._on_batch_end ("validation_step_timing" , pl_module )
205
205
206
206
def on_test_batch_start (self , trainer , pl_module , batch , batch_idx , dataloader_idx ):
@@ -453,7 +453,6 @@ def exp_manager(trainer: 'pytorch_lightning.Trainer', cfg: Optional[Union[DictCo
453
453
if cfg .disable_validation_on_resume :
454
454
# extend training loop to skip initial validation when resuming from checkpoint
455
455
configure_no_restart_validation_training_loop (trainer )
456
-
457
456
# Setup a stateless timer for use on clusters.
458
457
if cfg .max_time_per_run is not None :
459
458
found_ptl_timer = False
@@ -937,8 +936,8 @@ def configure_no_restart_validation_training_loop(trainer: pytorch_lightning.Tra
937
936
if type (trainer .fit_loop .epoch_loop ) != _TrainingEpochLoop :
938
937
warnings .warn ("Detected custom epoch loop. Skipping no validation on restart support." , UserWarning )
939
938
return
940
- loop = SkipResumeTrainingValidationLoop ( trainer . min_steps , trainer . max_steps )
941
- loop . trainer = trainer
939
+ ## Pass trainer object to avoid trainer getting overwritten as None
940
+ loop = SkipResumeTrainingValidationLoop ( trainer , trainer . min_steps , trainer . max_steps )
942
941
trainer .fit_loop .epoch_loop = loop
943
942
944
943
0 commit comments