Closed ZS-YANG closed 1 year ago
Thanks, we tested torch==2.0.1 locally. And I think torch versions >= 1.8.0 are fine.
thanks for replay, i have another questions . Firstly, will u provide the code for single gpu training? secondly,can the repvit model be successfully deployed through openvino or tensorrt? 😆
Hi, thanks for the questions. 😊
Firstly, will u provide the code for single gpu training?
Single gpu training can be enabled by setting the nproc_per_node to 1. For example,
python -m torch.distributed.launch --nproc_per_node=1 --master_port 12346 --use_env main.py --model repvit_m1 --data-path ~/imagenet --dist-eval
secondly,can the repvit model be successfully deployed through openvino or tensorrt?
Sure, here is a minimal example to export the model to tensorrt by Torch-TensorRT.
import torch_tensorrt
import utils
torch.autograd.set_grad_enabled(False)
from timm import create_model
import model
model = create_model('repvit_m1')
utils.replace_batchnorm(model)
model = model.to("cuda").eval()
trt_model = torch_tensorrt.compile(model, inputs= [torch_tensorrt.Input((2048, 3, 224, 224))])
torch.jit.save(trt_model, "repvit_m1.ts")
thanks for reply。 When I run the script(dist_test.sh), the following error is reported. The command to run is 【 ./dist_test.sh configs/mask_rcnn_repvit_m2_fpn_1x_coco.py weights/repvit_m2_coco.pth 1 --eval bbox segm】
(repvit) yzs@yzs-RESCUER-R720-15IKBN:~/project/RepViT-main/detection$ ./dist_test.sh configs/mask_rcnn_repvit_m2_fpn_1x_coco.py weights/repvit_m2_coco.pth 1 --eval bbox segm
/home/yzs/anaconda3/envs/repvit/lib/python3.8/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(
/home/yzs/anaconda3/envs/repvit/lib/python3.8/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: test.py [-h] [--work-dir WORK_DIR] [--out OUT] [--fuse-conv-bn] [--format-only] [--eval EVAL [EVAL ...]] [--show] [--show-dir SHOW_DIR]
[--show-score-thr SHOW_SCORE_THR] [--gpu-collect] [--tmpdir TMPDIR] [--cfg-options CFG_OPTIONS [CFG_OPTIONS ...]] [--options OPTIONS [OPTIONS ...]]
[--eval-options EVAL_OPTIONS [EVAL_OPTIONS ...]] [--launcher {none,pytorch,slurm,mpi}] [--local-rank LOCAL_RANK]
config checkpoint
test.py: error: unrecognized arguments: --local_rank=0
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 2) local_rank: 0 (pid: 15378) of binary: /home/yzs/anaconda3/envs/repvit/bin/python
Traceback (most recent call last):
File "/home/yzs/anaconda3/envs/repvit/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/yzs/anaconda3/envs/repvit/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/yzs/anaconda3/envs/repvit/lib/python3.8/site-packages/torch/distributed/launch.py", line 193, in <module>
main()
File "/home/yzs/anaconda3/envs/repvit/lib/python3.8/site-packages/torch/distributed/launch.py", line 189, in main
launch(args)
File "/home/yzs/anaconda3/envs/repvit/lib/python3.8/site-packages/torch/distributed/launch.py", line 174, in launch
run(args)
File "/home/yzs/anaconda3/envs/repvit/lib/python3.8/site-packages/torch/distributed/run.py", line 752, in run
elastic_launch(
File "/home/yzs/anaconda3/envs/repvit/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 131, in __call__
return launch_agent(self._config, self._entrypoint, list(args))
File "/home/yzs/anaconda3/envs/repvit/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 245, in launch_agent
raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
============================================================
./test.py FAILED
------------------------------------------------------------
Failures:
<NO_OTHER_FAILURES>
------------------------------------------------------------
Root Cause (first observed failure):
[0]:
time : 2023-07-25_21:38:15
host : yzs-RESCUER-R720-15IKBN
rank : 0 (local_rank: 0)
exitcode : 2 (pid: 15378)
error_file: <N/A>
traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
============================================================
****
Hi, this problem is related to the torch version. You can modify --local-rank
to --local_rank
in this line and try again. https://github.com/THU-MIG/RepViT/blob/2d85a4c5b709a99fc81ffe4384333e244fda4ab5/detection/test.py#L95
Thanks, the torch I tried is 1.12.1. I think I should get the code to work firstly,so i will test torch==2.0,thanks.
thanks for this work. I would like to know what torch version is suitable for this project. 😆