From 43a6d1edeb62a15ac69ef69ef2352581ba1947a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Wed, 9 Jun 2021 16:23:23 +0200 Subject: [PATCH] hack --- pytorch_lightning/trainer/trainer.py | 4 ++++ pytorch_lightning/trainer/training_loop.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/pytorch_lightning/trainer/trainer.py b/pytorch_lightning/trainer/trainer.py index 7f94a19fca..45255fd06d 100644 --- a/pytorch_lightning/trainer/trainer.py +++ b/pytorch_lightning/trainer/trainer.py @@ -990,6 +990,8 @@ class Trainer( # release memory before running any other hooks del batch + import gc + gc.collect() # log batch metrics self.logger_connector.log_evaluation_step_metrics() @@ -1101,6 +1103,8 @@ class Trainer( # release memory before running any other hooks del batch + import gc + gc.collect() # call hook results = self.predict_loop.on_predict_epoch_end() diff --git a/pytorch_lightning/trainer/training_loop.py b/pytorch_lightning/trainer/training_loop.py index 45cd320631..28ed1767eb 100644 --- a/pytorch_lightning/trainer/training_loop.py +++ b/pytorch_lightning/trainer/training_loop.py @@ -510,6 +510,8 @@ class TrainLoop: # release memory before running any other hooks del batch + import gc + gc.collect() # ----------------------------------------- # SAVE METRICS TO LOGGERS