Skip to content

Commit a4166bf

Browse files
committed
🚧 .
1 parent 96eb070 commit a4166bf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pytorch_lightning/trainer/evaluation_loop.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ class TrainerEvaluationLoopMixin(ABC):
180180
tpu_id: int
181181
verbose_test: bool
182182
running_sanity_check: bool
183+
testing: bool
183184
amp_backend: AMPType
184185

185186
# Callback system
@@ -371,9 +372,11 @@ def _evaluate(
371372

372373
# track outputs for collation
373374
if output is not None:
375+
do_write_preds = self.testing and isinstance(output, EvalResult) and not self.running_sanity_check
374376
# Add predictions to our prediction collection if they are found in outputs
375-
if isinstance(output, EvalResult):
376-
predictions.add(output.pop('_predictions', None))
377+
if do_write_preds:
378+
predictions.add(output.pop('predictions', None))
379+
377380
dl_outputs.append(output)
378381

379382
self.__eval_add_step_metrics(output)

0 commit comments

Comments
 (0)