monotonous bookkeeping
(config)
| 17 | torch.cuda.manual_seed_all(seed) |
| 18 | |
| 19 | def setup_logging(config): |
| 20 | """ monotonous bookkeeping """ |
| 21 | work_dir = config.system.work_dir |
| 22 | # create the work directory if it doesn't already exist |
| 23 | os.makedirs(work_dir, exist_ok=True) |
| 24 | # log the args (if any) |
| 25 | with open(os.path.join(work_dir, 'args.txt'), 'w') as f: |
| 26 | f.write(' '.join(sys.argv)) |
| 27 | # log the config itself |
| 28 | with open(os.path.join(work_dir, 'config.json'), 'w') as f: |
| 29 | f.write(json.dumps(config.to_dict(), indent=4)) |
| 30 | |
| 31 | class CfgNode: |
| 32 | """ a lightweight configuration class inspired by yacs """ |
no test coverage detected