MCPcopy
hub / github.com/OpenMotionLab/MotionGPT / new_dir

Function new_dir

mGPT/utils/logger.py:55–68  ·  view source on GitHub ↗
(cfg, phase, time_str, final_output_dir)

Source from the content-addressed store, hash-verified

53
54@rank_zero_only
55def new_dir(cfg, phase, time_str, final_output_dir):
56 # new experiment folder
57 cfg.TIME = str(time_str)
58 if os.path.exists(final_output_dir) and not os.path.exists(cfg.TRAIN.RESUME) and not cfg.DEBUG and phase not in ['test', 'demo']:
59 file_list = sorted(os.listdir(final_output_dir), reverse=True)
60 for item in file_list:
61 if item.endswith('.log'):
62 os.rename(str(final_output_dir), str(final_output_dir) + '_' + cfg.TIME)
63 break
64 final_output_dir.mkdir(parents=True, exist_ok=True)
65 # write config yaml
66 config_file = '{}_{}_{}.yaml'.format('config', time_str, phase)
67 final_config_file = final_output_dir / config_file
68 OmegaConf.save(config=cfg, f=final_config_file)

Callers 1

create_loggerFunction · 0.85

Calls 1

saveMethod · 0.80

Tested by

no test coverage detected