MCPcopy Index your code
hub / github.com/OpenGVLab/InternVL / main

Function main

classification/main_accelerate.py:343–373  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

341
342
343def main():
344 args, config = parse_option()
345 os.makedirs(config.OUTPUT, exist_ok=True)
346 logging.basicConfig(
347 format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
348 datefmt='%m/%d/%Y %H:%M:%S',
349 filename=os.path.join(config.OUTPUT, 'run.log'),
350 level=logging.INFO,
351 )
352
353 loggers = ['tensorboard']
354 accelerator = Accelerator(
355 log_with=loggers,
356 project_dir=config.OUTPUT,
357 gradient_accumulation_steps=config.TRAIN.ACCUMULATION_STEPS,
358 # When use deepspeed, you could not comment this out
359 # even if you set loss scale to 1.0 in deepspeed config.
360 kwargs_handlers=[GradScalerKwargs(enabled=not args.disable_grad_scalar)],
361 )
362 logger.info(accelerator.state, main_process_only=False)
363
364 scale_learning_rate(config, accelerator.num_processes)
365 seed_everything(config.SEED, accelerator.process_index)
366 save_config(config)
367
368 logger.info(config.dump())
369
370 if config.EVAL_MODE:
371 eval(config, accelerator)
372 else:
373 train(config, accelerator)
374
375
376if __name__ == '__main__':

Callers 1

main_accelerate.pyFile · 0.70

Calls 6

parse_optionFunction · 0.70
scale_learning_rateFunction · 0.70
seed_everythingFunction · 0.70
save_configFunction · 0.70
evalFunction · 0.70
trainFunction · 0.70

Tested by

no test coverage detected