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

AttributeError: 'SyncBatchNorm' object has no attribute '_specify_ddp_gpu_num' #55

Closed
CamelKing1997 opened this issue Sep 13, 2021 · 3 comments

Comments

@CamelKing1997
Copy link

How can i slove this problem?

(vedaseg) E:\00_Public_Project\vedaseg>python tools/train.py configs/voc_deeplabv3plus.py
2021-09-13 14:58:24,709 - INFO - Set cudnn deterministic False
2021-09-13 14:58:24,710 - INFO - Set cudnn benchmark True
2021-09-13 14:58:24,710 - INFO - Set seed 0
2021-09-13 14:58:24,711 - INFO - Build model
Traceback (most recent call last):
File "tools/train.py", line 47, in
main()
File "tools/train.py", line 42, in main
runner = TrainRunner(train_cfg, inference_cfg, common_cfg)
File "tools..\vedaseg\runners\train_runner.py", line 16, in init
super().init(inference_cfg, base_cfg)
File "tools..\vedaseg\runners\inference_runner.py", line 21, in init
self.model = self._build_model(inference_cfg['model'])
File "tools..\vedaseg\runners\inference_runner.py", line 39, in _build_model
model = build_model(cfg)
File "tools..\vedaseg\models\builder.py", line 10, in build_model
encoder = build_encoder(cfg.get('encoder'))
File "tools..\vedaseg\models\encoders\builder.py", line 9, in build_encoder
backbone = build_from_cfg(cfg['backbone'], BACKBONES, default_args)
File "tools..\vedaseg\utils\registry.py", line 51, in build_from_cfg
return build_from_registry(cfg, src, default_args=default_args)
File "tools..\vedaseg\utils\registry.py", line 84, in build_from_registry
return obj_cls(**args)
File "tools..\vedaseg\models\encoders\backbones\resnet.py", line 315, in init
act_cfg=act_cfg)
File "tools..\vedaseg\models\encoders\backbones\resnet.py", line 181, in init
self._make_stem_layer()
File "tools..\vedaseg\models\encoders\backbones\resnet.py", line 270, in _make_stem_layer
self.bn1 = self._norm_layer(self.inplanes)
File "tools..\vedaseg\models\utils\norm.py", line 81, in build_norm_layer
layer._specify_ddp_gpu_num(1) # noqa
File "C:\ProgramData\Anaconda3\envs\vedaseg\lib\site-packages\torch\nn\modules\module.py", line 1131, in getattr
type(self).name, name))
AttributeError: 'SyncBatchNorm' object has no attribute '_specify_ddp_gpu_num'

@DarthThomas
Copy link
Contributor

Hi,

Thanks for your interest in our VedaSeg.

Based on the information you provided, it's likely that you are using a newer version of Pytorch.
The method _specify_ddp_gpu_num is no longer there in the latest version of Pytorch and that's the reason you are getting this AttributeError.

To resolve this problem, I recommend you try PyTorch 1.4.0.

Also, it seems that you are using Windows, we recommend using Linux instead.

@CamelKing1997
Copy link
Author

Thx. I will try PyTorch 1.4.0.

@panovr
Copy link

panovr commented Nov 6, 2021

It seems _specify_ddp_gpu_num() is no longer available after PyTorch 1.9.0. I have tried PyTorch 1.8.2, and it worked.
open-mmlab/mmocr#325
open-mmlab/mmcv#1137

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

3 participants