本文整理汇总了Python中tensorboard_logger.configure方法的典型用法代码示例。如果您正苦于以下问题:Python tensorboard_logger.configure方法的具体用法?Python tensorboard_logger.configure怎么用?Python tensorboard_logger.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tensorboard_logger
的用法示例。
在下文中一共展示了tensorboard_logger.configure方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import tensorboard_logger [as 别名]
# 或者: from tensorboard_logger import configure [as 别名]
def __init__(self, log_dir):
if not os.path.isdir(log_dir):
# if the directory does not exist we create the directory
os.makedirs(log_dir)
else:
# clean previous logged data under the same directory name
self._remove(log_dir)
# configure the project
configure(log_dir)
self.global_step = 0
示例2: run
# 需要导入模块: import tensorboard_logger [as 别名]
# 或者: from tensorboard_logger import configure [as 别名]
def run(harn):
harn.log('Begin training')
if False:
# TODO: can we run this as a subprocess that dies when we die?
# or do we need to run externally?
# tensorboard --logdir runs
# http://aretha:6006
pass
if tensorboard_logger:
harn.log('Initializing tensorboard')
tensorboard_logger.configure("runs/ibeis", flush_secs=2)
if harn.use_cuda:
harn.log('Fitting model on GPU({})'.format(harn.gpu_num))
harn.model.cuda(harn.gpu_num)
else:
harn.log('Fitting model on the CPU')
if harn.class_weights is not None:
harn.class_weights, = harn._to_xpu(harn.class_weights)
lr = harn.lr_scheduler(harn.epoch)
harn.optimizer = harn.optimizer_cls(harn.model.parameters(), lr=lr)
# train loop
while not harn.check_termination():
harn.train_epoch()
if harn.vali_loader:
harn.validation_epoch()
harn.save_snapshot()
harn.epoch += 1
示例3: __init__
# 需要导入模块: import tensorboard_logger [as 别名]
# 或者: from tensorboard_logger import configure [as 别名]
def __init__(self, log_dir):
# clean previous logged data under the same directory name
self._remove(log_dir)
# configure the project
configure(log_dir)
self.global_step = 0
示例4: __init__
# 需要导入模块: import tensorboard_logger [as 别名]
# 或者: from tensorboard_logger import configure [as 别名]
def __init__(self, log_dir, remove_previous_files = False):
# clean previous logged data under the same directory name
if remove_previous_files:
self._remove(log_dir)
# configure the project
configure(log_dir)
self.global_step = 0
示例5: tensorboard_log
# 需要导入模块: import tensorboard_logger [as 别名]
# 或者: from tensorboard_logger import configure [as 别名]
def tensorboard_log(self, budget, epoch, log, logdir):
import tensorboard_logger as tl
worker_path = 'Train/'
try:
tl.log_value(worker_path + 'budget', float(budget), int(time.time()))
except:
tl.configure(logdir)
tl.log_value(worker_path + 'budget', float(budget), int(time.time()))
tl.log_value(worker_path + 'epoch', float(epoch + 1), int(time.time()))
for name, value in log.items():
tl.log_value(worker_path + name, float(value), int(time.time()))