MCPcopy Create free account
hub / github.com/cientgu/VQ-Diffusion / get_args

Function get_args

train.py:28–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26DIST_URL = 'tcp://%s:%s' % (MASTER_ADDR, MASTER_PORT)
27
28def get_args():
29 parser = argparse.ArgumentParser(description='PyTorch Training script')
30 parser.add_argument('--config_file', type=str, default='configs/vqvae_celeba_attribute_cond.yaml',
31 help='path of config file')
32 parser.add_argument('--name', type=str, default='',
33 help='the name of this experiment, if not provided, set to'
34 'the name of config file')
35 parser.add_argument('--output', type=str, default='OUTPUT',
36 help='directory to save the results')
37 parser.add_argument('--log_frequency', type=int, default=100,
38 help='print frequency (default: 100)')
39 parser.add_argument('--load_path', type=str, default=None,
40 help='path to model that need to be loaded, '
41 'used for loading pretrained model')
42 parser.add_argument('--resume_name', type=str, default=None,
43 help='resume one experiment with the given name')
44 parser.add_argument('--auto_resume', action='store_true',
45 help='automatically resume the training')
46
47 # args for ddp
48 parser.add_argument('--num_node', type=int, default=1,
49 help='number of nodes for distributed training')
50 parser.add_argument('--node_rank', type=int, default=NODE_RANK,
51 help='node rank for distributed training')
52 parser.add_argument('--dist_url', type=str, default=DIST_URL,
53 help='url used to set up distributed training')
54 parser.add_argument('--gpu', type=int, default=None,
55 help='GPU id to use. If given, only the specific gpu will be'
56 ' used, and ddp will be disabled')
57 parser.add_argument('--sync_bn', action='store_true',
58 help='use sync BN layer')
59 parser.add_argument('--tensorboard', action='store_true',
60 help='use tensorboard for logging')
61 parser.add_argument('--timestamp', action='store_true', # default=True,
62 help='use tensorboard for logging')
63 # args for random
64 parser.add_argument('--seed', type=int, default=None,
65 help='seed for initializing training. ')
66 parser.add_argument('--cudnn_deterministic', action='store_true',
67 help='set cudnn.deterministic True')
68
69 parser.add_argument('--amp', action='store_true', # default=True,
70 help='automatic mixture of precesion')
71
72 parser.add_argument('--debug', action='store_true', default=False,
73 help='set as debug mode')
74 # args for modify config
75 parser.add_argument(
76 "opts",
77 help="Modify config options using the command-line",
78 default=None,
79 nargs=argparse.REMAINDER,
80 )
81
82 args = parser.parse_args()
83 args.cwd = os.path.abspath(os.path.dirname(__file__))
84
85 if args.resume_name is not None:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected