MCPcopy Create free account
hub / github.com/NVlabs/SegFormer / parse_args

Function parse_args

tools/train.py:19–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17
18
19def parse_args():
20 parser = argparse.ArgumentParser(description='Train a segmentor')
21 parser.add_argument('config', help='train config file path')
22 parser.add_argument('--work-dir', help='the dir to save logs and models')
23 parser.add_argument(
24 '--load-from', help='the checkpoint file to load weights from')
25 parser.add_argument(
26 '--resume-from', help='the checkpoint file to resume from')
27 parser.add_argument(
28 '--no-validate',
29 action='store_true',
30 help='whether not to evaluate the checkpoint during training')
31 group_gpus = parser.add_mutually_exclusive_group()
32 group_gpus.add_argument(
33 '--gpus',
34 type=int,
35 help='number of gpus to use '
36 '(only applicable to non-distributed training)')
37 group_gpus.add_argument(
38 '--gpu-ids',
39 type=int,
40 nargs='+',
41 help='ids of gpus to use '
42 '(only applicable to non-distributed training)')
43 parser.add_argument('--seed', type=int, default=None, help='random seed')
44 parser.add_argument(
45 '--deterministic',
46 action='store_true',
47 help='whether to set deterministic options for CUDNN backend.')
48 parser.add_argument(
49 '--options', nargs='+', action=DictAction, help='custom options')
50 parser.add_argument(
51 '--launcher',
52 choices=['none', 'pytorch', 'slurm', 'mpi'],
53 default='none',
54 help='job launcher')
55 parser.add_argument('--local_rank', type=int, default=0)
56 args = parser.parse_args()
57 if 'LOCAL_RANK' not in os.environ:
58 os.environ['LOCAL_RANK'] = str(args.local_rank)
59
60 return args
61
62
63def main():

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected