MCPcopy Create free account
hub / github.com/AutonomousVehicleLaboratory/SemVecNet / parse_args

Function parse_args

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

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected