MCPcopy
hub / github.com/microsoft/Cream / add_common_args

Function add_common_args

TinyViT/utils.py:15–54  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

13
14
15def add_common_args(parser):
16 parser.add_argument('--cfg', type=str, required=True,
17 metavar="FILE", help='path to config file', )
18 parser.add_argument(
19 "--opts",
20 help="Modify config options by adding 'KEY VALUE' pairs. ",
21 default=None,
22 nargs='+',
23 )
24
25 # easy config modification
26 parser.add_argument('--batch-size', type=int,
27 help="batch size for single GPU")
28 parser.add_argument('--data-path', type=str, help='path to dataset')
29 parser.add_argument('--pretrained',
30 help='pretrained weight from checkpoint, could be imagenet22k pretrained weight')
31 parser.add_argument('--resume', help='resume from checkpoint')
32 parser.add_argument('--accumulation-steps', type=int,
33 help="gradient accumulation steps")
34 parser.add_argument('--use-checkpoint', action='store_true',
35 help="whether to use gradient checkpointing to save memory")
36 parser.add_argument('--disable_amp', action='store_true',
37 help='Disable pytorch amp')
38 parser.add_argument('--output', default='output', type=str, metavar='PATH',
39 help='root of output folder, the full path is <output>/<model_name>/<tag> (default: output)')
40 parser.add_argument('--tag', help='tag of experiment')
41 parser.add_argument('--eval', action='store_true',
42 help='Perform evaluation only')
43 parser.add_argument('--only-cpu', action='store_true',
44 help='Perform evaluation on CPU')
45 parser.add_argument('--throughput', action='store_true',
46 help='Test throughput only')
47 parser.add_argument('--use-sync-bn', action='store_true',
48 default=False, help='sync bn')
49 parser.add_argument('--use-wandb', action='store_true',
50 default=False, help='use wandb to record log')
51
52 # distributed training
53 parser.add_argument("--local_rank", type=int,
54 help='local rank for DistributedDataParallel')
55
56
57def load_checkpoint(config, model, optimizer, lr_scheduler, loss_scaler, logger):

Callers 2

parse_optionFunction · 0.90
parse_optionFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected