File tree Expand file tree Collapse file tree 2 files changed +3
-0
lines changed
pytorch_lightning/trainer Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -992,6 +992,7 @@ def _run_evaluation(self) -> _EVALUATE_OUTPUT:
992992 del batch
993993 import gc
994994 gc .collect ()
995+ torch .cuda .empty_cache ()
995996
996997 # log batch metrics
997998 self .logger_connector .update_eval_step_metrics ()
@@ -1102,6 +1103,7 @@ def _run_predict(self) -> Optional[_PREDICT_OUTPUT]:
11021103 del batch
11031104 import gc
11041105 gc .collect ()
1106+ torch .cuda .empty_cache ()
11051107
11061108 # call hook
11071109 results = self .predict_loop .on_predict_epoch_end ()
Original file line number Diff line number Diff line change @@ -485,6 +485,7 @@ def run_training_epoch(self):
485485 del batch
486486 import gc
487487 gc .collect ()
488+ torch .cuda .empty_cache ()
488489
489490 # -----------------------------------------
490491 # SAVE METRICS TO LOGGERS AND PROGRESS_BAR
You can’t perform that action at this time.
0 commit comments