MCPcopy Create free account
hub / github.com/InternRobotics/P3Former / parse_args

Function parse_args

train.py:14–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12from mmdet3d.utils import replace_ceph_backend
13
14def parse_args():
15 parser = argparse.ArgumentParser(description='Train a 3D detector')
16 parser.add_argument('config', help='train config file path')
17 parser.add_argument('--work-dir', help='the dir to save logs and models')
18 parser.add_argument('--checkpoint', help='the dir to save logs and models')
19 parser.add_argument(
20 '--amp',
21 action='store_true',
22 default=False,
23 help='enable automatic-mixed-precision training')
24 parser.add_argument(
25 '--auto-scale-lr',
26 action='store_true',
27 help='enable automatically scaling LR.')
28 parser.add_argument(
29 '--resume',
30 nargs='?',
31 type=str,
32 const='auto',
33 help='If specify checkpoint path, resume from it, while if not '
34 'specify, try to auto resume from the latest checkpoint '
35 'in the work directory.')
36 parser.add_argument(
37 '--ceph', action='store_true', help='Use ceph as data storage backend')
38 parser.add_argument(
39 '--cfg-options',
40 nargs='+',
41 action=DictAction,
42 help='override some settings in the used config, the key-value pair '
43 'in xxx=yyy format will be merged into config file. If the value to '
44 'be overwritten is a list, it should be like key="[a,b]" or key=a,b '
45 'It also allows nested list/tuple values, e.g. key="[(a,b),(c,d)]" '
46 'Note that the quotation marks are necessary and that no white space '
47 'is allowed.')
48 parser.add_argument(
49 '--launcher',
50 choices=['none', 'pytorch', 'slurm', 'mpi'],
51 default='none',
52 help='job launcher')
53 # When using PyTorch version >= 2.0.0, the `torch.distributed.launch`
54 # will pass the `--local-rank` parameter to `tools/train.py` instead
55 # of `--local_rank`.
56 parser.add_argument('--local_rank', '--local-rank', type=int, default=0)
57 args = parser.parse_args()
58 if 'LOCAL_RANK' not in os.environ:
59 os.environ['LOCAL_RANK'] = str(args.local_rank)
60 return args
61
62
63def main():

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected