Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syncBN 'super' object has no attribute '_specify_ddp_gpu_num' #2171

Closed
ZhaochongAn opened this issue Aug 1, 2022 · 5 comments
Closed

syncBN 'super' object has no attribute '_specify_ddp_gpu_num' #2171

ZhaochongAn opened this issue Aug 1, 2022 · 5 comments
Assignees

Comments

@ZhaochongAn
Copy link

Hi, I notice that you fixed this bug at #1138. But I still encounter this when I run my code. I install pytorch and mmcv-full through

pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
pip install mmcv-full==1.3.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html

The bug is as follows:

Traceback (most recent call last):
  File "/cluster/project/vss/lib64/python3.8/site-packages/mmcv/utils/registry.py", line 179, in build_from_cfg
    return obj_cls(**args)
  File "/cluster/home/vss/VSS-CFFM/mmseg/models/decode_heads/cffm_head.py", line 53, in __init__
    self.linear_fuse = ConvModule(
  File "/cluster/project/vss/lib64/python3.8/site-packages/mmcv/cnn/bricks/conv_module.py", line 147, in __init__
    self.norm_name, norm = build_norm_layer(norm_cfg, norm_channels)
  File "/cluster/project/vss/lib64/python3.8/site-packages/mmcv/cnn/bricks/norm.py", line 110, in build_norm_layer
    layer._specify_ddp_gpu_num(1)
  File "/cluster/project/vss/lib64/python3.8/site-packages/mmcv/utils/parrots_wrapper.py", line 87, in _specify_ddp_gpu_num
    super()._specify_ddp_gpu_num(gpu_size)
AttributeError: 'super' object has no attribute '_specify_ddp_gpu_num'

My env:
Cuda=11.1.1
pytorch=1.9.0
mmcv=1.3.0

Thank you for help!

@zhouzaida
Copy link
Collaborator

Could you check whether torch.nn.SyncBatchNorm has this method?

@ZhaochongAn
Copy link
Author

ZhaochongAn commented Aug 1, 2022

Could you check whether torch.nn.SyncBatchNorm has this method?

I just check as follows:
$ torch.nn.SyncBatchNorm
<class 'torch.nn.modules.batchnorm.SyncBatchNorm'>
$ torch.nn.SyncBatchNorm._specify_ddp_gpu_num()
Traceback (most recent call last):
File "", line 1, in
TypeError: _specify_ddp_gpu_num() missing 2 required positional arguments: 'self' and 'gpu_size'

@zhouzaida
Copy link
Collaborator

Hi, this error had been resolved since v1.3.9 so you can upgrade your mmcv to v1.3.9 or higher with the following command

pip install mmcv-full==1.3.9 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html

@ZhaochongAn
Copy link
Author

But my current codebase is from mmseg which has assert clause to check the mmcv version to be from 1.1.4 to 1.3.0 in its init.py.

MMCV_MIN = '1.1.4'
MMCV_MAX = '1.3.0'
assert (mmcv_min_version <= mmcv_version <= mmcv_max_version), \
    f'MMCV=={mmcv.__version__} is used but incompatible. ' \
    f'Please install mmcv>={mmcv_min_version}, <={mmcv_max_version}.'

Thus if I update mmcv to 1.3.9, I need to remove the version check. Will remove the version assert clause impact the running of the code base?

@zhouzaida
Copy link
Collaborator

Got it. You also can refer to #1138 to fix the error you met.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants