(opt_file, experiments_root)
| 239 | |
| 240 | @master_only |
| 241 | def copy_opt_file(opt_file, experiments_root): |
| 242 | # copy the yml file to the experiment root |
| 243 | import sys |
| 244 | import time |
| 245 | from shutil import copyfile |
| 246 | cmd = ' '.join(sys.argv) |
| 247 | filename = osp.join(experiments_root, osp.basename(opt_file)) |
| 248 | copyfile(opt_file, filename) |
| 249 | |
| 250 | with open(filename, 'r+') as f: |
| 251 | lines = f.readlines() |
| 252 | lines.insert(0, f'# GENERATE TIME: {time.asctime()}\n# CMD:\n# {cmd}\n\n') |
| 253 | f.seek(0) |
| 254 | f.writelines(lines) |