本文整理匯總了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()))