open-mmlab / mmselfsup

OpenMMLab Self-Supervised Learning Toolbox and Benchmark
https://mmselfsup.readthedocs.io/en/latest/
Apache License 2.0
3.2k stars 432 forks source link

ModuleNotFoundError: No module named 'tools.benchmarks' #343

Closed Yoooss closed 2 years ago

Yoooss commented 2 years ago

The command I use is "bash tools/benchmarks/mmdetection/mim_dist_train_c4.sh configs/benchmarks/mmdetection/voc0712/faster_rcnn_r50_c4_mstrain_2x_voc0712.py checkpoints/densecl_resnet50_8xb32-coslr-200e_in1k_20220225-8c7808fe.pth 1 ".

And I got the error as below:

(mmselfsup) ls@ls:~/mmselfsup$ bash tools/benchmarks/mmdetection/mim_dist_train_c4.sh configs/benchmarks/mmdetection/voc0712/faster_rcnn_r50_c4_mstrain_2x_voc0712.py checkpoints/densecl_resnet50_8xb32-coslr-200e_in1k_20220225-8c7808fe.pth 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/mmdet/.mim/tools/train.py", line 220, in main() File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/mmdet/.mim/tools/train.py", line 106, in main cfg = Config.fromfile(args.config) File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/mmcv/utils/config.py", line 337, in fromfile import_modules_from_strings(cfg_dict['custom_imports']) File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/mmcv/utils/misc.py", line 80, in import_modules_from_strings raise ImportError ImportError Killing subprocess 495 Traceback (most recent call last): File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/torch/distributed/launch.py", line 340, in main() File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/torch/distributed/launch.py", line 326, in main sigkill_handler(signal.SIGTERM, None) # not coming back File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/torch/distributed/launch.py", line 301, in sigkill_handler raise subprocess.CalledProcessError(returncode=last_return_code, cmd=cmd) subprocess.CalledProcessError: Command '['/home/ls/anaconda3/envs/mmselfsup/bin/python', '-u', '/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/mmdet/.mim/tools/train.py', '--local_rank=0', 'configs/benchmarks/mmdetection/voc0712/faster_rcnn_r50_c4_mstrain_2x_voc0712.py', '--launcher', 'pytorch', '--work-dir', 'work_dirs/benchmarks/mmdetection/voc0712/faster_rcnn_r50_c4_mstrain_2x_voc0712/densecl_resnet50_8xb32-coslr-200e_in1k_20220225-8c7808fe.pth', '--cfg-options', 'model.backbone.init_cfg.type=Pretrained', 'model.backbone.init_cfg.checkpoint=checkpoints/densecl_resnet50_8xb32-coslr-200e_in1k_20220225-8c7808fe.pth', 'model.roi_head.shared_head.init_cfg.type=Pretrained', 'model.roi_head.shared_head.init_cfg.checkpoint=checkpoints/densecl_resnet50_8xb32-coslr-200e_in1k_20220225-8c7808fe.pth']' returned non-zero exit status 1. Traceback (most recent call last): File "/home/ls/anaconda3/envs/mmselfsup/bin/mim", line 8, in sys.exit(cli()) File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/click/core.py", line 610, in invoke return callback(args, kwargs) File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/mim/commands/train.py", line 108, in cli other_args=other_args) File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/mim/commands/train.py", line 257, in train cmd, env=dict(os.environ, MASTER_PORT=str(port))) File "/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/subprocess.py", line 363, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['python', '-m', 'torch.distributed.launch', '--nproc_per_node=1', '--master_port=29281', '/home/ls/anaconda3/envs/mmselfsup/lib/python3.7/site-packages/mmdet/.mim/tools/train.py', 'configs/benchmarks/mmdetection/voc0712/faster_rcnn_r50_c4_mstrain_2x_voc0712.py', '--launcher', 'pytorch', '--work-dir', 'work_dirs/benchmarks/mmdetection/voc0712/faster_rcnn_r50_c4_mstrain_2x_voc0712/densecl_resnet50_8xb32-coslr-200e_in1k_20220225-8c7808fe.pth', '--cfg-options', 'model.backbone.init_cfg.type=Pretrained', 'model.backbone.init_cfg.checkpoint=checkpoints/densecl_resnet50_8xb32-coslr-200e_in1k_20220225-8c7808fe.pth', 'model.roi_head.shared_head.init_cfg.type=Pretrained', 'model.roi_head.shared_head.init_cfg.checkpoint=checkpoints/densecl_resnet50_8xb32-coslr-200e_in1k_20220225-8c7808fe.pth']' returned non-zero exit status 1.

Thanks for your help.

Yoooss commented 2 years ago

I found the solution in the issue "https://github.com/open-mmlab/mmdetection/issues/7887" is uninstall the detectron2. And I run the command "pip uninstall detectron2" to remove the detectron2. However, it still raised the same error as above. May I ask how to fix it? Thanks for your help.

fangyixiao18 commented 2 years ago

I checked the link of mmdet, do you have any other package which contains tools? we will update codes and try to avoid this error

Yoooss commented 2 years ago

I searched for the solution and uninstalled the detectron following one solution. However the error still raised and I still don't know how to solve it. How could I check if I have other package which contains tools? May I get some help?Thanks for your help.

Yoooss commented 2 years ago

I checked my installed package again and found that it is "vissl" who caused this error because it contains tools.

fangyixiao18 commented 2 years ago

I checked my installed package again and found that it is "vissl" who caused this error because it contains tools.

Sorry for the inconvenience. We will update it in the future version to avoid this error.