KeyError: "Recognizer3D: 'SwinTransformer3D is not in the models registry'"
See original GitHub issueDescribe the bug
While running the training script “tools/train.py” this error occurs.
Reproduction Run the command:
python Video-Swin-Transformer/tools/train.py _Video-Swin-Transformer/configs/recognition/swin/swin_base_patch244_window877_kinetics600_22k.py
- Did you make any modifications on the code or config? - No. Did you understand what you have modified? - No
- What dataset did you use? - Kinetics600
Environment
- Please run
PYTHONPATH=${PWD}:$PYTHONPATH python mmaction/utils/collect_env.py
to collect necessary environment information and paste it here.
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
sys.platform: linux
Python: 3.7.10 | packaged by conda-forge | (default, Feb 19 2021, 16:07:37) [GCC 9.3.0]
CUDA available: True
GPU 0: Tesla P100-PCIE-16GB
CUDA_HOME: /usr/local/cuda
NVCC: Build cuda_11.0_bu.TC445_37.28845127_0
GCC: gcc (Debian 8.3.0-6) 8.3.0
PyTorch: 1.7.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.6.0 (Git Hash 5ef631a030a6f73131c77892041042805a06064f)
- 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;-gencode;arch=compute_75,code=sm_75
- CuDNN 7.6.5
- Magma 2.5.2
- Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN_WRAPPER -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, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=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.10.0+cu102
OpenCV: 4.5.3
MMCV: 1.3.12
MMCV Compiler: GCC 7.3
MMCV CUDA Compiler: 10.2
MMAction2: 0.17.0+
- You may add addition that may be helpful for locating the problem, such as
- How you installed PyTorch [e.g., pip, conda, source] – using pip
- Other environment variables that may be related (such as
$PATH
,$LD_LIBRARY_PATH
,$PYTHONPATH
, etc.) - None
Error traceback
{'type': 'Recognizer3D', 'backbone': {'type': 'SwinTransformer3D', 'patch_size': (2, 4, 4), 'embed_dim': 128, 'depths': [2, 2, 18, 2], 'num_heads': [4, 8, 16, 32], 'window_size': (8, 7, 7), 'mlp_ratio': 4.0, 'qkv_bias': True, 'qk_scale': None, 'drop_rate': 0.0, 'attn_drop_rate': 0.0, 'drop_path_rate': 0.2, 'patch_norm': True}, 'cls_head': {'type': 'I3DHead', 'in_channels': 1024, 'num_classes': 600, 'spatial_type': 'avg', 'dropout_ratio': 0.5}, 'test_cfg': {'average_clips': 'prob', 'max_testing_views': 2}}
Traceback (most recent call last):
File "/opt/conda/lib/python3.7/site-packages/mmcv/utils/registry.py", line 52, in build_from_cfg
return obj_cls(**args)
File "/opt/conda/lib/python3.7/site-packages/mmaction/models/recognizers/base.py", line 75, in __init__
self.backbone = builder.build_backbone(backbone)
File "/opt/conda/lib/python3.7/site-packages/mmaction/models/builder.py", line 29, in build_backbone
return BACKBONES.build(cfg)
File "/opt/conda/lib/python3.7/site-packages/mmcv/utils/registry.py", line 212, in build
return self.build_func(*args, **kwargs, registry=self)
File "/opt/conda/lib/python3.7/site-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg
return build_from_cfg(cfg, registry, default_args)
File "/opt/conda/lib/python3.7/site-packages/mmcv/utils/registry.py", line 45, in build_from_cfg
f'{obj_type} is not in the {registry.name} registry')
KeyError: 'SwinTransformer3D is not in the models registry'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Video-Swin-Transformer/tools/train.py", line 196, in <module>
main()
File "Video-Swin-Transformer/tools/train.py", line 154, in main
model = build_model(cfg.model,train_cfg=cfg.get('train_cfg'),test_cfg=cfg.get('test_cfg'))
File "/opt/conda/lib/python3.7/site-packages/mmaction/models/builder.py", line 70, in build_model
return build_localizer(cfg)
File "/opt/conda/lib/python3.7/site-packages/mmaction/models/builder.py", line 62, in build_localizer
return LOCALIZERS.build(cfg)
File "/opt/conda/lib/python3.7/site-packages/mmcv/utils/registry.py", line 212, in build
return self.build_func(*args, **kwargs, registry=self)
File "/opt/conda/lib/python3.7/site-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg
return build_from_cfg(cfg, registry, default_args)
File "/opt/conda/lib/python3.7/site-packages/mmcv/utils/registry.py", line 55, in build_from_cfg
raise type(e)(f'{obj_cls.__name__}: {e}')
KeyError: "Recognizer3D: 'SwinTransformer3D is not in the models registry'"
Other packages versions
mmcv-full == 1.3.12 pytorch==1.7.0 mmaction2==0.18.0 mmdet == 2.16.0 scipy==1.6.3 numpy==1.19.5
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Swin Transformer is not in the backbone registry'解决方法
后来找了一个类似的报错解决办法,试了一下,就成功解决了,可以运行了。 (75条消息) Python——报错解决: KeyError: 'XXXX is not in the models registry' ...
Read more >'SwinTransformer3D is not in the models registry'" #1 - Github ...
KeyError : "Recognizer3D: 'SwinTransformer3D is not in the models registry'" issue from Video-Swin-Transformer/SwinTransformer github repository.
Read more >This is an official implementation for "Video Swin Transformers".
... line 54, in build_from_cfg raise type(e)(f'{obj_cls.name}: {e}') KeyError: "Recognizer3D: 'SwinTransformer3D is not in the models registry'".
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, please uninstall mmaction2, and run
pip install -v -e . --user
maybe you can try
works for me while building a docker image