open-mmlab / mmselfsup

OpenMMLab Self-Supervised Learning Toolbox and Benchmark
https://mmselfsup.readthedocs.io/en/latest/
Apache License 2.0
3.14k stars 429 forks source link

Pytorch 1.10 with CUDA 11.3 is not compatible with MMCV==2.0.0.rc4 #741

Closed letdivedeep closed 1 year ago

letdivedeep commented 1 year ago

Branch

1.x branch (1.x version, such as v1.0.0rc2, or dev-1.x branch)

Prerequisite

Environment

sys.platform: linux Python: 3.7.11 (default, Jul 27 2021, 14:32:16) [GCC 7.5.0] CUDA available: True numpy_random_seed: 2147483648 GPU 0: NVIDIA A10G CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 11.3, V11.3.109 GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 PyTorch: 1.10.0 PyTorch compiling details: PyTorch built with:

TorchVision: 0.11.0 OpenCV: 4.7.0 MMEngine: 0.6.0 MMCV: 2.0.0rc4 MMCV Compiler: GCC 9.3 MMCV CUDA Compiler: 11.3 MMSelfSup: 1.0.0rc6+6c13b42

Describe the bug

I have an environment with pytorch 1.10.0 and CUDA 11.3, when i try to install the mmselfsup from the 1.x branch through the demo notebook given.

I found when we install a mmcv version of 2.0.0rc4, with mmcls as 1.0.0rc5 and mmselfsup as 1.0.0rc6, we are getting an error saying

AssertionError: MMCV==2.0.0rc4 is used but incompatible. Please install mmcv>=1.3.17, <=1.8.0. 

Screenshot 2023-04-05 at 7 24 33 PM

and when we install the mmcv version as 1.7.1 we get this error at mmcls and mmselfsup

AssertionError: MMCV==1.7.1 is used but incompatible. Please install mmcv>=2.0.0rc1, <2.0.0.

Screenshot 2023-04-05 at 7 24 15 PM

Reproduces the problem - code sample

import os
import torch

if torch.cuda.is_available():
    os.environ['CUBLAS_WORKSPACE_CONFIG'] = ':16:8'

from mmengine.config import Config, DictAction
from mmengine.runner import Runner

from mmselfsup.utils import register_all_modules

# register all modules in mmselfsup into the registries
# do not init the default scope here because it will be init in the runner
register_all_modules(init_default_scope=False)

# build the runner from config
runner = Runner.from_cfg(cfg)

# start training
runner.train()

Reproduces the problem - command or script

No response

Reproduces the problem - error message

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
/tmp/ipykernel_5426/394836790.py in <module>
      6 # register all modules in mmselfsup into the registries
      7 # do not init the default scope here because it will be init in the runner
----> 8 register_all_modules(init_default_scope=False)
      9 
     10 # build the runner from config

/mmselfsup/mmselfsup/utils/setup_env.py in register_all_modules(init_default_scope)
     19     """  # noqa
     20     import mmselfsup.datasets  # noqa: F401,F403
---> 21     import mmselfsup.engine  # noqa: F401,F403
     22     import mmselfsup.evaluation  # noqa: F401,F403
     23     import mmselfsup.models  # noqa: F401,F403

/mmselfsup/mmselfsup/engine/__init__.py in <module>
      1 # Copyright (c) OpenMMLab. All rights reserved.
----> 2 from .hooks import *  # noqa: F401, F403
      3 from .optimizers import *  # noqa: F401, F403

/mmselfsup/mmselfsup/engine/hooks/__init__.py in <module>
      1 # Copyright (c) OpenMMLab. All rights reserved.
----> 2 from .deepcluster_hook import DeepClusterHook
      3 from .densecl_hook import DenseCLHook
      4 from .odc_hook import ODCHook
      5 from .simsiam_hook import SimSiamHook

/mmselfsup/mmselfsup/engine/hooks/deepcluster_hook.py in <module>
      9 from mmengine.logging import print_log
     10 
---> 11 from mmselfsup.models.utils import Extractor
     12 from mmselfsup.registry import HOOKS
     13 from mmselfsup.utils import clustering as _clustering

/mmselfsup/mmselfsup/models/__init__.py in <module>
      1 # Copyright (c) OpenMMLab. All rights reserved.
----> 2 from .algorithms import *  # noqa: F401,F403
      3 from .backbones import *  # noqa: F401,F403
      4 from .builder import (ALGORITHMS, BACKBONES, HEADS, LOSSES, MEMORIES, NECKS,
      5                       build_algorithm, build_backbone, build_head, build_loss,

/mmselfsup/mmselfsup/models/algorithms/__init__.py in <module>
      3 from .base import BaseModel
      4 from .beit import BEiT
----> 5 from .byol import BYOL
      6 from .cae import CAE
      7 from .deepcluster import DeepCluster

/mmselfsup/mmselfsup/models/algorithms/byol.py in <module>
      7 from mmselfsup.registry import MODELS
      8 from mmselfsup.structures import SelfSupDataSample
----> 9 from ..utils import CosineEMA
     10 from .base import BaseModel
     11 

/mmselfsup/mmselfsup/models/utils/__init__.py in <module>
     20 
     21 try:
---> 22     from .res_layer_extra_norm import ResLayerExtraNorm
     23 except ImportError:
     24     ResLayerExtraNorm = None

/mmselfsup/mmselfsup/models/utils/res_layer_extra_norm.py in <module>
      3 
      4 try:
----> 5     from mmdet.models.backbones import ResNet
      6     from mmdet.models.builder import SHARED_HEADS
      7     from mmdet.models.roi_heads.shared_heads.res_layer import ResLayer

/opt/conda/lib/python3.7/site-packages/mmdet/__init__.py in <module>
     24 assert (mmcv_version >= digit_version(mmcv_minimum_version)
     25         and mmcv_version <= digit_version(mmcv_maximum_version)), \
---> 26     f'MMCV=={mmcv.__version__} is used but incompatible. ' \
     27     f'Please install mmcv>={mmcv_minimum_version}, <={mmcv_maximum_version}.'
     28 

AssertionError: MMCV==2.0.0rc4 is used but incompatible. Please install mmcv>=1.3.17, <=1.8.0.

Additional information

  1. Are we supporting pytorch 1.10 with 1.x branch
  2. how to resolve the issue of mmcv version conflicts

Have attached the demo notebook with all the respective logs mmselfsup_colab_tutorial.ipynb.zip

fangyixiao18 commented 1 year ago

I guess the problem is the version of your mmdet, please update your mmdet to 3.0.0rc6 to match the version

letdivedeep commented 1 year ago

@fangyixiao18 Thanks for your input ... it helped me solve the issue