MCPcopy Create free account
hub / github.com/alinlab/SelfPatch / parse_args

Function parse_args

segmentation/tools/train.py:22–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected