utils_2.py 749 B

1234567891011121314151617181920
  1. def prepare_directories(args, run_name):
  2. if not os.path.isdir(args.data_path):
  3. raise Exception("Invalid data path. No such directory")
  4. if not os.path.isdir(args.log_path):
  5. os.makedirs(args.log_path)
  6. if args.pretrained_path:
  7. if not os.path.isdir(args.pretrained_path) or \
  8. not os.path.isdir(os.path.join(args.pretrained_path, 'states')):
  9. raise Exception("Invalid path. No such directory with pretrained model")
  10. else:
  11. exp_path = os.path.join(args.log_path, run_name)
  12. os.makedirs(exp_path)
  13. os.makedirs(os.path.join(exp_path, 'samples'))
  14. os.makedirs(os.path.join(exp_path, 'states'))
  15. os.makedirs(os.path.join(exp_path, 'tensorboard_logs'))