| 53 | |
| 54 | @rank_zero_only |
| 55 | def 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) |