From 7933a1121c306b1f5f6902186f29e92680918ad1 Mon Sep 17 00:00:00 2001 From: Kaushal Bhogale Date: Thu, 20 Aug 2020 15:43:34 +0530 Subject: [PATCH] Add checkpoint saving on graceful shutdown (ctr+c) (#3067) --- pytorch_lightning/trainer/training_loop.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pytorch_lightning/trainer/training_loop.py b/pytorch_lightning/trainer/training_loop.py index 8577f98f9d..bb5ed82650 100644 --- a/pytorch_lightning/trainer/training_loop.py +++ b/pytorch_lightning/trainer/training_loop.py @@ -1132,6 +1132,10 @@ class TrainerTrainLoopMixin(ABC): self._teardown_already_run = True + # Save latest checkpoint + log.info('Saving latest checkpoint..') + self.check_checkpoint_callback(should_check_val=False) + # Train end events with self.profiler.profile('on_train_end'): # callbacks