def write_config(self, args, extra_msg):
with open(self.log_file, 'a+') as f:
self._comment("=" * 40, f)
self._comment("{} initiated at {}".format(
self.name, datetime.isoformat(datetime.now())
), f)
self._comment("-" * 40, f) # arguments passed
self._comment("Data: " + args.data, f)
self._comment("Batchsize: {}".format(args.batchsize), f)
self._comment("Test ratio: {}".format(args.test), f)
self._comment("Hard triplet ratio: {}".format(args.skilled), f)
dev = "CPU" if args.gpu < 0 else "GPU ".format(args.gpu)
self._comment("Device: " + dev, f)
if args.initmodel:
self._comment("Init model: " + args.initmodel, f)
if args.resume:
self._comment("Resume state: " + args.resume, f)
self._comment("-" * 40, f) # parameters set in script
self._comment("Optimizer: " + self.optimizer.__class__.__name__, f)
self._comment("Initial LR: {}".format(self.optimizer.lr), f)
self._comment("LR interval: {}".format(args.lrinterval), f)
self._comment("Weight decay: {}".format(args.weight_decay), f)
self._comment("Epoch: {}".format(self.optimizer.epoch), f)
if extra_msg:
self._comment(extra_msg, f)
self._comment("-" * 40, f) # complete call
self._comment("{}".format(sys.argv), f)
self._comment("=" * 40, f)
评论列表
文章目录