MCPcopy Create free account
hub / github.com/OpenDriveLab/OccNet / parse_args

Function parse_args

tools/train.py:33–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31def parse_args():
32 parser = argparse.ArgumentParser(description='Train a detector')
33 parser.add_argument('config', help='train config file path')
34 parser.add_argument('--work-dir', help='the dir to save logs and models')
35 parser.add_argument(
36 '--resume-from', help='the checkpoint file to resume from')
37 parser.add_argument(
38 '--no-validate',
39 action='store_true',
40 help='whether not to evaluate the checkpoint during training')
41 group_gpus = parser.add_mutually_exclusive_group()
42 group_gpus.add_argument(
43 '--gpus',
44 type=int,
45 help='number of gpus to use '
46 '(only applicable to non-distributed training)')
47 group_gpus.add_argument(
48 '--gpu-ids',
49 type=int,
50 nargs='+',
51 help='ids of gpus to use '
52 '(only applicable to non-distributed training)')
53 parser.add_argument('--seed', type=int, default=0, help='random seed')
54 parser.add_argument(
55 '--deterministic',
56 action='store_true',
57 help='whether to set deterministic options for CUDNN backend.')
58 parser.add_argument(
59 '--options',
60 nargs='+',
61 action=DictAction,
62 help='override some settings in the used config, the key-value pair '
63 'in xxx=yyy format will be merged into config file (deprecate), '
64 'change to --cfg-options instead.')
65 parser.add_argument(
66 '--cfg-options',
67 nargs='+',
68 action=DictAction,
69 help='override some settings in the used config, the key-value pair '
70 'in xxx=yyy format will be merged into config file. If the value to '
71 'be overwritten is a list, it should be like key="[a,b]" or key=a,b '
72 'It also allows nested list/tuple values, e.g. key="[(a,b),(c,d)]" '
73 'Note that the quotation marks are necessary and that no white space '
74 'is allowed.')
75 parser.add_argument(
76 '--launcher',
77 choices=['none', 'pytorch', 'slurm', 'mpi'],
78 default='none',
79 help='job launcher')
80 parser.add_argument('--local_rank', type=int, default=0)
81 parser.add_argument(
82 '--autoscale-lr',
83 action='store_true',
84 help='automatically scale lr with the number of gpus')
85 args = parser.parse_args()
86 if 'LOCAL_RANK' not in os.environ:
87 os.environ['LOCAL_RANK'] = str(args.local_rank)
88
89 if args.options and args.cfg_options:
90 raise ValueError(

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected