File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
pytorch_lightning/trainer Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -990,6 +990,8 @@ def _run_evaluation(self) -> _EVALUATE_OUTPUT:
990990
991991 # release memory before running any other hooks
992992 del batch
993+ import gc
994+ gc .collect ()
993995
994996 # log batch metrics
995997 self .logger_connector .log_evaluation_step_metrics ()
@@ -1101,6 +1103,8 @@ def _run_predict(self) -> Optional[_PREDICT_OUTPUT]:
11011103
11021104 # release memory before running any other hooks
11031105 del batch
1106+ import gc
1107+ gc .collect ()
11041108
11051109 # call hook
11061110 results = self .predict_loop .on_predict_epoch_end ()
Original file line number Diff line number Diff line change @@ -510,6 +510,8 @@ def run_training_epoch(self):
510510
511511 # release memory before running any other hooks
512512 del batch
513+ import gc
514+ gc .collect ()
513515
514516 # -----------------------------------------
515517 # SAVE METRICS TO LOGGERS
You can’t perform that action at this time.
0 commit comments