diff --git a/mmengine/runner/loops.py b/mmengine/runner/loops.py index 5a678db7b9..822756ef25 100644 --- a/mmengine/runner/loops.py +++ b/mmengine/runner/loops.py @@ -403,7 +403,8 @@ def run_iter(self, idx, data_batch: Sequence[dict]): with autocast(enabled=self.fp16): outputs = self.runner.model.val_step(data_batch) - outputs, self.val_loss = _update_losses(outputs, self.val_loss) + if isinstance(outputs, list): + outputs, self.val_loss = _update_losses(outputs, self.val_loss) self.evaluator.process(data_samples=outputs, data_batch=data_batch) self.runner.call_hook( @@ -486,7 +487,8 @@ def run_iter(self, idx, data_batch: Sequence[dict]) -> None: with autocast(enabled=self.fp16): outputs = self.runner.model.test_step(data_batch) - outputs, self.test_loss = _update_losses(outputs, self.test_loss) + if isinstance(outputs, list): + outputs, self.test_loss = _update_losses(outputs, self.test_loss) self.evaluator.process(data_samples=outputs, data_batch=data_batch) self.runner.call_hook(