We list some common troubles faced by many users and their corresponding solutions here. Feel free to enrich the list if you find any frequent issues and have ways to help others to solve them. If the contents here do not cover your issue, please create an issue using the provided templates and make sure you fill in all required information in the template.
Compatibility issue between MMCV and MMDetection; "ConvWS is already registered in conv layer"; "AssertionError: MMCV==xxx is used but incompatible. Please install mmcv>=xxx, <=xxx."
Please install the correct version of MMCV for the version of your MMDetection following the installation instruction.
"No module named 'mmcv.ops'"; "No module named 'mmcv._ext'".
pip uninstall mmcv
."RTX 30 series card fails when building MMCV or MMDet"
MMCV_WITH_OPS=1 MMCV_CUDA_ARGS='-gencode=arch=compute_80,code=sm_80' pip install -e .
.nvcc fatal : Unsupported gpu architecture 'compute_86'
. This means that the compiler should optimize for sm_86, i.e., nvidia 30 series card, but such optimizations have not been supported by CUDA toolkit 11.0.MMCV_CUDA_ARGS='-gencode=arch=compute_80,code=sm_80'
, which tells nvcc
to optimize for sm_80, i.e., Nvidia A100. Although A100 is different from the 30 series card, they use similar ampere architecture. This may hurt the performance but it works."invalid device function" or "no kernel image is available for execution".
/usr/local/
), nvcc --version
and conda list cudatoolkit
version match.python mmdet/utils/collect_env.py
to check whether PyTorch, torchvision, and MMCV are built for the correct GPU architecture.TORCH_CUDA_ARCH_LIST
to reinstall MMCV.TORCH_CUDA_ARCH_LIST=7.0 pip install mmcv-full
to build MMCV for Volta GPUs."undefined symbol" or "cannot open xxx.so".
python mmdet/utils/collect_env.py
to see if "MMCV Compiler"
/"MMCV CUDA Compiler"
is the same as "GCC"
/"CUDA_HOME"
.python mmdet/utils/collect_env.py
to check whether PyTorch, torchvision, and MMCV are built by and running on the same environment.setuptools.sandbox.UnpickleableException: DistutilsSetupError("each element of 'ext_modules' option must be an Extension instance or 2-tuple")
pip install -r requirements.txt
.setuptools
, Cython
, and PyTorch
in your environment."Segmentation fault".
Check you GCC version and use GCC 5.4. This usually caused by the incompatibility between PyTorch and the environment (e.g., GCC < 4.9 for PyTorch). We also recommend the users to avoid using GCC 5.5 because many feedbacks report that GCC 5.5 will cause "segmentation fault" and simply changing it to GCC 5.4 could solve the problem.
Check whether PyTorch is correctly installed and could use CUDA op, e.g. type the following command in your terminal.
python -c 'import torch; print(torch.cuda.is_available())'
And see whether they could correctly output results.
If Pytorch is correctly installed, check whether MMCV is correctly installed.
python -c 'import mmcv; import mmcv.ops'
If MMCV is correctly installed, then there will be no issue of the above two commands.
If MMCV and Pytorch is correctly installed, you man use ipdb
, pdb
to set breakpoints or directly add 'print' in mmdetection code and see which part leads the segmentation fault.
"Loss goes Nan"
warmup_iters
from 500 to 1000 or 2000.grad_clip
is None
, you can add gradient clippint to avoid gradients that are too large, i.e., set optimizer_config=dict(_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
in your config file. If your config does not inherits from any basic config that contains optimizer_config=dict(grad_clip=None)
, you can simply add optimizer_config=dict(grad_clip=dict(max_norm=35, norm_type=2))
.’GPU out of memory"
gpu_assign_thr=N
in the config of assigner thus the assigner will calculate box overlaps through CPU when there are more than N GT boxes.with_cp=True
in the backbone. This uses the sublinear strategy in PyTorch to reduce GPU memory cost in the backbone.config/fp16
. The loss_scale
might need further tuning for different models."RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one"
find_unused_parameters = True
in the config to solve the above problems or find those unused parameters manually.