MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / main

Function main

main.py:89–379  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

87
88
89def main(args):
90 utils.init_distributed_mode_ssc(args)
91 print('Loading config file from {}'.format(args.config_file))
92 shutil.copy2(args.config_file,'config/aios_smplx.py')
93 from config.config import cfg
94
95 if args.options is not None:
96 cfg.merge_from_dict(args.options)
97 if args.rank == 0:
98 save_cfg_path = os.path.join(args.output_dir, 'config_cfg.py')
99 cfg.dump(save_cfg_path)
100 save_json_path = os.path.join(args.output_dir, 'config_args_raw.json')
101 with open(save_json_path, 'w') as f:
102 json.dump(vars(args), f, indent=2)
103 cfg_dict = cfg._cfg_dict.to_dict()
104 args_vars = vars(args)
105 for k, v in cfg_dict.items():
106 if k not in args_vars:
107 setattr(args, k, v)
108 else:
109 continue
110 raise ValueError('Key {} can used by args only'.format(k))
111
112 # update some new args temporally
113 if not getattr(args, 'use_ema', None):
114 args.use_ema = False
115 if not getattr(args, 'debug', None):
116 args.debug = False
117
118
119 # setup logger
120 os.makedirs(args.output_dir, exist_ok=True)
121 logger = setup_logger(output=os.path.join(args.output_dir, 'info.txt'),
122 distributed_rank=args.rank,
123 color=False,
124 name='detr')
125 logger.info('git:\n {}\n'.format(utils.get_sha()))
126 logger.info('Command: ' + ' '.join(sys.argv))
127 if args.rank == 0:
128 save_json_path = os.path.join(args.output_dir, 'config_args_all.json')
129 # print("args:", vars(args))
130 with open(save_json_path, 'w') as f:
131 json.dump(vars(args), f, indent=2)
132 logger.info('Full config saved to {}'.format(save_json_path))
133 logger.info('world size: {}'.format(args.world_size))
134 logger.info('rank: {}'.format(args.rank))
135 logger.info('local_rank: {}'.format(args.local_rank))
136 logger.info('args: ' + str(args) + '\n')
137
138 if args.frozen_weights is not None:
139 assert args.masks, 'Frozen training is meant for segmentation only'
140
141 device = torch.device(args.device)
142
143 # fix the seed for reproducibility
144 seed = args.seed + utils.get_rank()
145 torch.manual_seed(seed)
146 np.random.seed(seed)

Callers 1

main.pyFile · 0.70

Calls 15

setup_loggerFunction · 0.90
ModelEmaClass · 0.90
get_param_dictFunction · 0.90
MultipleDatasetsClass · 0.90
build_dataloaderFunction · 0.90
inferenceFunction · 0.90
evaluateFunction · 0.90
train_one_epochFunction · 0.90
build_model_mainFunction · 0.85
check_keepFunction · 0.85
merge_from_dictMethod · 0.80
to_dictMethod · 0.80

Tested by

no test coverage detected