Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LXXXXR committed Mar 23, 2021
1 parent 9d3bc06 commit a9356ca
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions mmcls/core/evaluation/eval_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,8 @@
from mmcv.runner import Hook
from torch.utils.data import DataLoader

try:
from mmcv.runner import EvalHook, DistEvalHook # noqa: F811
except ImportError:
warnings.warn(
'DeprecationWarning: EvalHook and DistEvalHook in mmcls will be '
'deprecated, please install mmcv through master branch.')


class EvalHook(Hook): # noqa: F811
class EvalHook(Hook):
"""Evaluation hook.
Args:
Expand All @@ -21,6 +14,9 @@ class EvalHook(Hook): # noqa: F811
"""

def __init__(self, dataloader, interval=1, by_epoch=True, **eval_kwargs):
warnings.warn(
'DeprecationWarning: EvalHook and DistEvalHook in mmcls will be '
'deprecated, please install mmcv through master branch.')
if not isinstance(dataloader, DataLoader):
raise TypeError('dataloader must be a pytorch DataLoader, but got'
f' {type(dataloader)}')
Expand Down Expand Up @@ -52,7 +48,7 @@ def evaluate(self, runner, results):
runner.log_buffer.ready = True


class DistEvalHook(EvalHook): # noqa: F811
class DistEvalHook(EvalHook):
"""Distributed evaluation hook.
Args:
Expand All @@ -70,6 +66,9 @@ def __init__(self,
gpu_collect=False,
by_epoch=True,
**eval_kwargs):
warnings.warn(
'DeprecationWarning: EvalHook and DistEvalHook in mmcls will be '
'deprecated, please install mmcv through master branch.')
if not isinstance(dataloader, DataLoader):
raise TypeError('dataloader must be a pytorch DataLoader, but got '
f'{type(dataloader)}')
Expand Down

0 comments on commit a9356ca

Please sign in to comment.