MCPcopy Create free account
hub / github.com/SwinTransformer/Transformer-SSL / update_config

Function update_config

config.py:215–254  ·  view source on GitHub ↗
(config, args)

Source from the content-addressed store, hash-verified

213
214
215def update_config(config, args):
216 _update_config_from_file(config, args.cfg)
217
218 config.defrost()
219 if args.opts:
220 config.merge_from_list(args.opts)
221
222 # merge from specific arguments
223 if args.batch_size:
224 config.DATA.BATCH_SIZE = args.batch_size
225 if args.data_path:
226 config.DATA.DATA_PATH = args.data_path
227 if args.zip:
228 config.DATA.ZIP_MODE = True
229 if args.cache_mode:
230 config.DATA.CACHE_MODE = args.cache_mode
231 if args.resume:
232 config.MODEL.RESUME = args.resume
233 if args.accumulation_steps:
234 config.TRAIN.ACCUMULATION_STEPS = args.accumulation_steps
235 if args.use_checkpoint:
236 config.TRAIN.USE_CHECKPOINT = True
237 if args.amp_opt_level:
238 config.AMP_OPT_LEVEL = args.amp_opt_level
239 if args.output:
240 config.OUTPUT = args.output
241 if args.tag:
242 config.TAG = args.tag
243 if args.eval:
244 config.EVAL_MODE = True
245 if args.throughput:
246 config.THROUGHPUT_MODE = True
247
248 # set local rank for distributed training
249 config.LOCAL_RANK = args.local_rank
250
251 # output folder
252 config.OUTPUT = os.path.join(config.OUTPUT, config.MODEL.NAME, config.TAG)
253
254 config.freeze()
255
256
257def get_config(args):

Callers 1

get_configFunction · 0.85

Calls 1

_update_config_from_fileFunction · 0.85

Tested by

no test coverage detected