(root_dir, exp_name)
| 54 | return logger |
| 55 | |
| 56 | def set_log_dir(root_dir, exp_name): |
| 57 | path_dict = {} |
| 58 | os.makedirs(root_dir, exist_ok=True) |
| 59 | |
| 60 | # set log path |
| 61 | exp_path = os.path.join(root_dir, exp_name) |
| 62 | now = datetime.now(dateutil.tz.tzlocal()) |
| 63 | timestamp = now.strftime('%Y_%m_%d_%H_%M_%S') |
| 64 | prefix = exp_path + '_' + timestamp |
| 65 | os.makedirs(prefix) |
| 66 | path_dict['prefix'] = prefix |
| 67 | |
| 68 | # set checkpoint path |
| 69 | ckpt_path = os.path.join(prefix, 'Model') |
| 70 | os.makedirs(ckpt_path) |
| 71 | path_dict['ckpt_path'] = ckpt_path |
| 72 | |
| 73 | log_path = os.path.join(prefix, 'Log') |
| 74 | os.makedirs(log_path) |
| 75 | path_dict['log_path'] = log_path |
| 76 | |
| 77 | # set sample image path for fid calculation |
| 78 | sample_path = os.path.join(prefix, 'Samples') |
| 79 | os.makedirs(sample_path) |
| 80 | path_dict['sample_path'] = sample_path |
| 81 | |
| 82 | return path_dict |
| 83 | |
| 84 | def save_checkpoint(states, is_best, output_dir, |
| 85 | filename='checkpoint.pth'): |
nothing calls this directly
no outgoing calls
no test coverage detected