Skip to content

Commit

Permalink
[Fix] Fix mmcls import error (#206)
Browse files Browse the repository at this point in the history
* fix mmcls import error

* fix __init__.py
  • Loading branch information
wutongshenqiu committed Jul 26, 2022
1 parent 5495acc commit 6987511
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 19 deletions.
4 changes: 2 additions & 2 deletions mmrazor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def digit_version(version_str: str, length: int = 4):
return tuple(release)


mmcv_minimum_version = '1.3.8'
mmcv_maximum_version = '1.6.0'
mmcv_minimum_version = '2.0.0rc0'
mmcv_maximum_version = '2.0.0'
mmcv_version = digit_version(mmcv.__version__)


Expand Down
4 changes: 2 additions & 2 deletions mmrazor/models/architectures/heads/darts_subnet_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from typing import List, Tuple

import torch
from mmcls.core.data_structures.cls_data_sample import ClsDataSample
from mmcls.metrics import Accuracy
from mmcls.data import ClsDataSample
from mmcls.evaluation import Accuracy
from mmcls.models.heads import LinearClsHead
from torch import nn

Expand Down
1 change: 0 additions & 1 deletion mmrazor/structures/subnet/fix_subnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import mmcv
from torch import nn


from mmrazor.utils import FixMutable, ValidFixMutable


Expand Down
2 changes: 1 addition & 1 deletion tests/test_models/test_algorithms/test_autoslim.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest
import torch
import torch.distributed as dist
from mmcls.core import ClsDataSample
from mmcls.data import ClsDataSample
from mmengine.optim import build_optim_wrapper

from mmrazor import digit_version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest
import torch
import torch.distributed as dist
from mmcls.core import ClsDataSample
from mmcls.data import ClsDataSample
from mmcv import fileio
from mmengine.optim import build_optim_wrapper

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from os.path import dirname

import torch
from mmcls.core import ClsDataSample
from mmcls.data import ClsDataSample
from mmcls.models import * # noqa: F401,F403

from mmrazor import digit_version
Expand Down
13 changes: 2 additions & 11 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,10 @@
import os
import os.path as osp

from mmcls.core import * # noqa: F401,F403
from mmcls.datasets import * # noqa: F401,F403
from mmcls.metrics import * # noqa: F401,F403
from mmcls.models import * # noqa: F401,F403
# TODO import mmcls and mmseg
from mmdet.core import * # noqa: F401,F403
from mmdet.datasets import * # noqa: F401,F403
from mmdet.metrics import * # noqa: F401,F403
from mmdet.models import * # noqa: F401,F403
from mmengine.config import Config, DictAction
from mmengine.runner import Runner

from mmrazor.core import * # noqa: F401,F403
from mmrazor.models import * # noqa: F401,F403
from mmrazor.utils import register_all_modules


# TODO: support fuse_conv_bn, visualization, and format_only
Expand Down Expand Up @@ -51,6 +41,7 @@ def parse_args():


def main():
register_all_modules(False)
args = parse_args()

# load config
Expand Down

0 comments on commit 6987511

Please sign in to comment.