MCPcopy Create free account
hub / github.com/MotrixLab/FineMoGen / parse_args

Function parse_args

tools/train.py:18–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected