File tree 1 file changed +4
-5
lines changed
pytorch_lightning/trainer
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -313,10 +313,10 @@ def dump_checkpoint(self, weights_only: bool = False):
313
313
}
314
314
315
315
if not weights_only :
316
- if self .checkpoint_callback is not None and self . checkpoint_callback is not False :
316
+ if self .checkpoint_callback :
317
317
checkpoint ['checkpoint_callback_best' ] = self .checkpoint_callback .best
318
318
319
- if self .early_stop_callback is not None and self . checkpoint_callback is not False :
319
+ if self .early_stop_callback :
320
320
checkpoint ['early_stop_callback_wait' ] = self .early_stop_callback .wait
321
321
checkpoint ['early_stop_callback_patience' ] = self .early_stop_callback .patience
322
322
@@ -386,9 +386,8 @@ def restore_training_state(self, checkpoint):
386
386
"""
387
387
if 'optimizer_states' not in checkpoint or 'lr_schedulers' not in checkpoint :
388
388
raise KeyError (
389
- f'Trying to restore training state but checkpoint contains only the model. '
390
- f'This is probably due to `ModelCheckpoint.save_weights_only` being set to '
391
- f'True.'
389
+ 'Trying to restore training state but checkpoint contains only the model.'
390
+ ' This is probably due to `ModelCheckpoint.save_weights_only` being set to `True`.'
392
391
)
393
392
394
393
if self .checkpoint_callback is not None and self .checkpoint_callback is not False :
You can’t perform that action at this time.
0 commit comments