当前位置: 首页>>代码示例>>Python>>正文


Python logger.get_benchmark_logger方法代码示例

本文整理汇总了Python中official.utils.logs.logger.get_benchmark_logger方法的典型用法代码示例。如果您正苦于以下问题:Python logger.get_benchmark_logger方法的具体用法?Python logger.get_benchmark_logger怎么用?Python logger.get_benchmark_logger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在official.utils.logs.logger的用法示例。


在下文中一共展示了logger.get_benchmark_logger方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_examples_per_second_hook

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import get_benchmark_logger [as 别名]
def get_examples_per_second_hook(every_n_steps=100,
                                 batch_size=128,
                                 warm_steps=5,
                                 **kwargs):  # pylint: disable=unused-argument
  """Function to get ExamplesPerSecondHook.

  Args:
    every_n_steps: `int`, print current and average examples per second every
      N steps.
    batch_size: `int`, total batch size used to calculate examples/second from
      global time.
    warm_steps: skip this number of steps before logging and running average.
    **kwargs: a dictionary of arguments to ExamplesPerSecondHook.

  Returns:
    Returns a ProfilerHook that writes out timelines that can be loaded into
    profiling tools like chrome://tracing.
  """
  return hooks.ExamplesPerSecondHook(
      batch_size=batch_size, every_n_steps=every_n_steps,
      warm_steps=warm_steps, metric_logger=logger.get_benchmark_logger()) 
开发者ID:GoogleCloudPlatform,项目名称:cloudml-samples,代码行数:23,代码来源:hooks_helper.py

示例2: get_logging_metric_hook

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import get_benchmark_logger [as 别名]
def get_logging_metric_hook(tensors_to_log=None,
                            every_n_secs=600,
                            **kwargs):  # pylint: disable=unused-argument
  """Function to get LoggingMetricHook.

  Args:
    tensors_to_log: List of tensor names or dictionary mapping labels to tensor
      names. If not set, log _TENSORS_TO_LOG by default.
    every_n_secs: `int`, the frequency for logging the metric. Default to every
      10 mins.

  Returns:
    Returns a LoggingMetricHook that saves tensor values in a JSON format.
  """
  if tensors_to_log is None:
    tensors_to_log = _TENSORS_TO_LOG
  return metric_hook.LoggingMetricHook(
      tensors=tensors_to_log,
      metric_logger=logger.get_benchmark_logger(),
      every_n_secs=every_n_secs)


# A dictionary to map one hook name and its corresponding function 
开发者ID:GoogleCloudPlatform,项目名称:cloudml-samples,代码行数:25,代码来源:hooks_helper.py

示例3: log_and_get_hooks

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import get_benchmark_logger [as 别名]
def log_and_get_hooks(eval_batch_size):
  """Convenience function for hook and logger creation."""
  # Create hooks that log information about the training and metric values
  train_hooks = hooks_helper.get_train_hooks(
      FLAGS.hooks,
      model_dir=FLAGS.model_dir,
      batch_size=FLAGS.batch_size,  # for ExamplesPerSecondHook
      tensors_to_log={"cross_entropy": "cross_entropy"}
  )
  run_params = {
      "batch_size": FLAGS.batch_size,
      "eval_batch_size": eval_batch_size,
      "number_factors": FLAGS.num_factors,
      "hr_threshold": FLAGS.hr_threshold,
      "train_epochs": FLAGS.train_epochs,
  }
  benchmark_logger = logger.get_benchmark_logger()
  benchmark_logger.log_run_info(
      model_name="recommendation",
      dataset_name=FLAGS.dataset,
      run_params=run_params,
      test_id=FLAGS.benchmark_test_id)

  return benchmark_logger, train_hooks 
开发者ID:IntelAI,项目名称:models,代码行数:26,代码来源:ncf_estimator_main.py

示例4: get_logging_metric_hook

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import get_benchmark_logger [as 别名]
def get_logging_metric_hook(tensors_to_log=None,
                            every_n_secs=600,
                            **kwargs):  # pylint: disable=unused-argument
  """Function to get LoggingMetricHook.

  Args:
    tensors_to_log: List of tensor names or dictionary mapping labels to tensor
      names. If not set, log _TENSORS_TO_LOG by default.
    every_n_secs: `int`, the frequency for logging the metric. Default to every
      10 mins.
    **kwargs: a dictionary of arguments.

  Returns:
    Returns a LoggingMetricHook that saves tensor values in a JSON format.
  """
  if tensors_to_log is None:
    tensors_to_log = _TENSORS_TO_LOG
  return metric_hook.LoggingMetricHook(
      tensors=tensors_to_log,
      metric_logger=logger.get_benchmark_logger(),
      every_n_secs=every_n_secs) 
开发者ID:IntelAI,项目名称:models,代码行数:23,代码来源:hooks_helper.py

示例5: test_get_default_benchmark_logger

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import get_benchmark_logger [as 别名]
def test_get_default_benchmark_logger(self):
    with flagsaver.flagsaver(benchmark_logger_type="foo"):
      self.assertIsInstance(logger.get_benchmark_logger(),
                            logger.BaseBenchmarkLogger) 
开发者ID:IntelAI,项目名称:models,代码行数:6,代码来源:logger_test.py

示例6: test_config_base_benchmark_logger

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import get_benchmark_logger [as 别名]
def test_config_base_benchmark_logger(self):
    with flagsaver.flagsaver(benchmark_logger_type="BaseBenchmarkLogger"):
      logger.config_benchmark_logger()
      self.assertIsInstance(logger.get_benchmark_logger(),
                            logger.BaseBenchmarkLogger) 
开发者ID:IntelAI,项目名称:models,代码行数:7,代码来源:logger_test.py

示例7: test_config_benchmark_bigquery_logger

# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import get_benchmark_logger [as 别名]
def test_config_benchmark_bigquery_logger(self, mock_bigquery_client):
    with flagsaver.flagsaver(benchmark_logger_type="BenchmarkBigQueryLogger"):
      logger.config_benchmark_logger()
      self.assertIsInstance(logger.get_benchmark_logger(),
                            logger.BenchmarkBigQueryLogger) 
开发者ID:IntelAI,项目名称:models,代码行数:7,代码来源:logger_test.py


注:本文中的official.utils.logs.logger.get_benchmark_logger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。