THU-MIG / RepViT

RepViT: Revisiting Mobile CNN From ViT Perspective [CVPR 2024] and RepViT-SAM: Towards Real-Time Segmenting Anything
https://arxiv.org/abs/2307.09283
Apache License 2.0
756 stars 56 forks source link

How to run repVit's detection network in one GPU environment #48

Open weldingCode opened 6 months ago

weldingCode commented 6 months ago

My experimental environment only has 1 GPU. How do I run the network under detection file?

jameslahm commented 6 months ago

Thanks for your interest. You could set #GPUS to 1, like below:

./dist_test.sh config_file path/to/checkpoint 1 --eval bbox segm
weldingCode commented 6 months ago

(yolov8) root@n1:/home/repvit/detection# ./dist_train.sh configs/mask_rcnn_repvit_m1_1_fpn_1x_coco.py 1 /opt/conda/envs/yolov8/lib/python3.9/site-packages/torch/distributed/launch.py:178: FutureWarning: The module torch.distributed.launch is deprecated and will be removed in future. Use torchrun. Note that --use_env is set by default in torchrun. If your script expects --local_rank argument to be set, please change it to read from os.environ['LOCAL_RANK'] instead. See https://pytorch.org/docs/stable/distributed.html#launch-utility for further instructions

warnings.warn(

/opt/conda/envs/yolov8/lib/python3.9/site-packages/mmcv/init.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details. warnings.warn( usage: train.py [-h] [--work-dir WORK_DIR] [--resume-from RESUME_FROM] [--auto-resume] [--no-validate] [--gpus GPUS | --gpu-ids GPU_IDS [GPU_IDS ...] | --gpu-id GPU_ID] [--seed SEED] [--diff-seed] [--deterministic] [--options OPTIONS [OPTIONS ...]] [--cfg-options CFG_OPTIONS [CFG_OPTIONS ...]] [--launcher {none,pytorch,slurm,mpi}] [--local-rank LOCAL_RANK] [--auto-scale-lr] config train.py: error: unrecognized arguments: --local_rank=0 ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 2) local_rank: 0 (pid: 3564) of binary: /opt/conda/envs/yolov8/bin/python Traceback (most recent call last): File "/opt/conda/envs/yolov8/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/opt/conda/envs/yolov8/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/opt/conda/envs/yolov8/lib/python3.9/site-packages/torch/distributed/launch.py", line 193, in main() File "/opt/conda/envs/yolov8/lib/python3.9/site-packages/torch/distributed/launch.py", line 189, in main launch(args) File "/opt/conda/envs/yolov8/lib/python3.9/site-packages/torch/distributed/launch.py", line 174, in launch run(args) File "/opt/conda/envs/yolov8/lib/python3.9/site-packages/torch/distributed/run.py", line 710, in run elastic_launch( File "/opt/conda/envs/yolov8/lib/python3.9/site-packages/torch/distributed/launcher/api.py", line 131, in call return launch_agent(self._config, self._entrypoint, list(args)) File "/opt/conda/envs/yolov8/lib/python3.9/site-packages/torch/distributed/launcher/api.py", line 259, in launch_agent raise ChildFailedError( torch.distributed.elastic.multiprocessing.errors.ChildFailedError:

./train.py FAILED

Failures:

# Root Cause (first observed failure): [0]: time : 2024-03-29_11:20:28 host : n1.example.com rank : 0 (local_rank: 0) exitcode : 2 (pid: 3564) error_file: traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html

会报这个错误

weldingCode commented 6 months ago

Can I use the command "_python train.py configs/mask_rcnn_repvit_m1_1_fpn_1xcoco.py 1"?

jameslahm commented 6 months ago

According to your error log, I guess that you could change --local-rank to --local_rank to address that problem.

weldingCode commented 6 months ago

According to your error log, I guess that you could change --local-rank to --local_rank to address that problem.

I still can not solve my problem, the most prompt is the version information does not match, can you update the tutorial?

jameslahm commented 6 months ago

https://github.com/THU-MIG/RepViT/blob/338506bc71d7b4e008cb6f1d94a559e8d8f969c6/detection/train.py#L95 Hi, this line can be changed to

parser.add_argument('--local_rank', type=int, default=0)