MCPcopy Index your code
hub / github.com/OpenDriveLab/DriveAdapter / parse_args

Function parse_args

open_loop_training/train.py:43–111  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected