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

[Bug] class CLIPResNet not registried correctly #1515

Closed
2 tasks done
jyshee opened this issue Nov 7, 2022 · 2 comments
Closed
2 tasks done

[Bug] class CLIPResNet not registried correctly #1515

jyshee opened this issue Nov 7, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@jyshee
Copy link
Contributor

jyshee commented Nov 7, 2022

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

1.x branch https://github.com/open-mmlab/mmocr/tree/dev-1.x

Environment

sys.platform: linux
Python: 3.6.6 (default, Jul 27 2020, 12:02:11) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CUDA available: True
numpy_random_seed: 2147483648
GPU 0,1,2,3,4,5,6,7: Tesla V100-SXM2-16GB
CUDA_HOME: /usr/local/cuda-10.2
NVCC: Cuda compilation tools, release 10.2, V10.2.8
GCC: gcc (GCC) 5.5.0
PyTorch: 1.8.0
PyTorch compiling details: PyTorch built with:

  • GCC 7.3
  • C++ Version: 201402
  • Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v1.7.0 (Git Hash 7aed236906b1f7a05c0917e5257a1af05e9ff683)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • NNPACK is enabled
  • CPU capability usage: AVX2
  • CUDA Runtime 10.2
  • NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70
  • CuDNN 7.6.5
  • Magma 2.5.2
  • Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=10.2, CUDNN_VERSION=7.6.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.8.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON,

TorchVision: 0.9.0
OpenCV: 4.2.0
MMEngine: 0.1.0
MMOCR: 1.0.0rc3+abf5a89

Reproduces the problem - code sample

CUDA_VISIBLE_DEVICES=0,1,2,3 ./tools/dist_train.sh configs/textdet/dbnet/dbnet_resnet50-oclip_1200e_icdar2015.py 4

Reproduces the problem - command or script

CUDA_VISIBLE_DEVICES=0,1,2,3 ./tools/dist_train.sh configs/textdet/dbnet/dbnet_resnet50-oclip_1200e_icdar2015.py 4

Reproduces the problem - error message

Traceback (most recent call last):
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmengine/registry/build_functions.py", line 121, in build_from_cfg
obj = obj_cls(**args) # type: ignore
File "/disk1/shenjingyi/OCR/mmocr/mmocr/models/common/backbones/clip_resnet.py", line 85, in init
**kwargs)
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmdet/models/backbones/resnet.py", line 483, in init
init_cfg=block_init_cfg)
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmdet/models/backbones/resnet.py", line 558, in make_res_layer
return ResLayer(**kwargs)
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmdet/models/layers/res_layer.py", line 73, in init
**kwargs))
File "/disk1/shenjingyi/OCR/mmocr/mmocr/models/common/backbones/clip_resnet.py", line 37, in init
super().init(**kwargs)
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmdet/models/backbones/resnet.py", line 215, in init
planes, self.after_conv2_plugins)
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmdet/models/backbones/resnet.py", line 236, in make_block_plugins
postfix=plugin.pop('postfix', ''))
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmcv/cnn/bricks/plugin.py", line 89, in build_plugin_layer
raise KeyError(f'Cannot find {plugin_layer} in registry under scope '
KeyError: 'Cannot find None in registry under scope name mmocr'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmengine/registry/build_functions.py", line 121, in build_from_cfg
obj = obj_cls(**args) # type: ignore
File "/disk1/shenjingyi/OCR/mmocr/mmocr/models/textdet/detectors/single_stage_text_detector.py", line 42, in init
self.backbone = MODELS.build(backbone)
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmengine/registry/registry.py", line 421, in build
return self.build_func(cfg, *args, **kwargs, registry=self)
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmengine/registry/build_functions.py", line 240, in build_model_from_cfg
return build_from_cfg(cfg, registry, default_args)
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmengine/registry/build_functions.py", line 136, in build_from_cfg
f'class {obj_cls.__name__} in ' # type: ignore
KeyError: "class CLIPResNet in mmocr/models/common/backbones/clip_resnet.py: 'Cannot find None in registry under scope name mmocr'"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./tools/train.py", line 117, in
main()
File "./tools/train.py", line 106, in main
runner = Runner.from_cfg(cfg)
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmengine/runner/runner.py", line 458, in from_cfg
cfg=cfg,
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmengine/runner/runner.py", line 401, in init
self.model = self.build_model(model)
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmengine/runner/runner.py", line 794, in build_model
model = MODELS.build(model)
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmengine/registry/registry.py", line 421, in build
return self.build_func(cfg, *args, **kwargs, registry=self)
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmengine/registry/build_functions.py", line 240, in build_model_from_cfg
return build_from_cfg(cfg, registry, default_args)
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/mmengine/registry/build_functions.py", line 136, in build_from_cfg
f'class {obj_cls.__name__} in ' # type: ignore
KeyError: 'class DBNet in mmocr/models/textdet/detectors/dbnet.py: "class CLIPResNet in mmocr/models/common/backbones/clip_resnet.py: 'Cannot find None in registry under scope name mmocr'"'
Killing subprocess 97090
Traceback (most recent call last):
File "/disk1/shenjingyi/opt/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/disk1/shenjingyi/opt/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/torch/distributed/launch.py", line 340, in
main()
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/torch/distributed/launch.py", line 326, in main
sigkill_handler(signal.SIGTERM, None) # not coming back
File "/home/forrest.sjy/virtual/torch1.7/lib/python3.6/site-packages/torch/distributed/launch.py", line 301, in sigkill_handler
raise subprocess.CalledProcessError(returncode=last_return_code, cmd=cmd)
subprocess.CalledProcessError: Command '['/home/forrest.sjy/virtual/torch1.7/bin/python', '-u', './tools/train.py', '--local_rank=0', 'configs/textdet/dbnet/dbnet_resnet50-oclip_1200e_icdar2015.py', '--launcher', 'pytorch']' returned non-zero exit status 1.

Additional information

No response

@jyshee jyshee added the bug Something isn't working label Nov 7, 2022
@Harold-lkk
Copy link
Collaborator

Harold-lkk commented Nov 7, 2022

Thanks for your report.
We forgot to register the plugins into the MODELS registry.
It can be easily fixed by adding from .plugins import * # NOQA into https://github.com/open-mmlab/mmocr/blob/dev-1.x/mmocr/models/common/__init__.py.

Would you like to create a PR to fix it Here?
You can refer to Contribution Guide for contributing.

@jyshee
Copy link
Contributor Author

jyshee commented Nov 7, 2022

I will try to fix it and create a PR. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants