Skip to content

Commit

Permalink
[Fix] Remove unused import
Browse files Browse the repository at this point in the history
  • Loading branch information
fanqiNO1 committed Feb 22, 2024
1 parent e48195d commit 6f8c6c7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mmengine/runner/loops.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from mmengine.evaluator import Evaluator
from mmengine.logging import print_log
from mmengine.registry import LOOPS
from mmengine.structures import BaseDataElement
from mmengine.utils import is_list_of
from .amp import autocast
from .base_loop import BaseLoop
Expand Down Expand Up @@ -363,7 +362,7 @@ def __init__(self,
logger='current',
level=logging.WARNING)
self.fp16 = fp16
self.val_loss = dict()
self.val_loss: Dict[str, list] = dict()

def run(self) -> dict:
"""Launch validation."""
Expand All @@ -381,7 +380,7 @@ def run(self) -> dict:
avg_loss = sum(loss_value) / len(loss_value)
metrics[loss_name] = avg_loss
if 'loss' in loss_name:
val_loss += avg_loss
val_loss += avg_loss # type: ignore
metrics['val_loss'] = val_loss

self.runner.call_hook('after_val_epoch', metrics=metrics)
Expand Down Expand Up @@ -458,7 +457,7 @@ def __init__(self,
logger='current',
level=logging.WARNING)
self.fp16 = fp16
self.test_loss = dict()
self.test_loss: Dict[str, list] = dict()

def run(self) -> dict:
"""Launch test."""
Expand All @@ -476,7 +475,7 @@ def run(self) -> dict:
avg_loss = sum(loss_value) / len(loss_value)
metrics[loss_name] = avg_loss
if 'loss' in loss_name:
test_loss += avg_loss
test_loss += avg_loss # type: ignore
metrics['test_loss'] = test_loss

self.runner.call_hook('after_test_epoch', metrics=metrics)
Expand Down

0 comments on commit 6f8c6c7

Please sign in to comment.