本文整理汇总了Python中official.utils.logs.logger.benchmark_context方法的典型用法代码示例。如果您正苦于以下问题:Python logger.benchmark_context方法的具体用法?Python logger.benchmark_context怎么用?Python logger.benchmark_context使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类official.utils.logs.logger
的用法示例。
在下文中一共展示了logger.benchmark_context方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def main(_):
flags_obj = flags.FLAGS
with logger.benchmark_context(flags_obj):
task = TransformerTask(flags_obj)
def _run_task(task):
if flags_obj.mode == "train":
task.train()
elif flags_obj.mode == "predict":
task.predict()
elif flags_obj.mode == "eval":
task.eval()
else:
raise ValueError("Invalid mode {}".format(flags_obj.mode))
if flags_obj.distribution_strategy != "tpu":
_run_task(task)
else:
primary_cpu_task = "/job:worker" if flags_obj.use_tpu_2vm_config else ""
with tf.device(primary_cpu_task):
_run_task(task)
开发者ID:ShivangShekhar,项目名称:Live-feed-object-device-identification-using-Tensorflow-and-OpenCV,代码行数:23,代码来源:transformer_main.py
示例2: main
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def main(_):
with logger.benchmark_context(FLAGS), \
mlperf_helper.LOGGER(FLAGS.output_ml_perf_compliance_logging):
mlperf_helper.set_ncf_root(os.path.split(os.path.abspath(__file__))[0])
run_ncf(FLAGS)
示例3: test_benchmark_context
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def test_benchmark_context(self, mock_config_benchmark_logger):
mock_logger = mock.MagicMock()
mock_config_benchmark_logger.return_value = mock_logger
with logger.benchmark_context(None):
tf.compat.v1.logging.info("start benchmarking")
mock_logger.on_finish.assert_called_once_with(logger.RUN_STATUS_SUCCESS)
示例4: test_benchmark_context_failure
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def test_benchmark_context_failure(self, mock_config_benchmark_logger):
mock_logger = mock.MagicMock()
mock_config_benchmark_logger.return_value = mock_logger
with self.assertRaises(RuntimeError):
with logger.benchmark_context(None):
raise RuntimeError("training error")
mock_logger.on_finish.assert_called_once_with(logger.RUN_STATUS_FAILURE)
示例5: test_benchmark_context
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def test_benchmark_context(self, mock_config_benchmark_logger):
mock_logger = mock.MagicMock()
mock_config_benchmark_logger.return_value = mock_logger
with logger.benchmark_context(None):
tf.logging.info("start benchmarking")
mock_logger.on_finish.assert_called_once_with(logger.RUN_STATUS_SUCCESS)
示例6: main
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def main(_):
with logger.benchmark_context(flags.FLAGS):
run(flags.FLAGS)
示例7: main
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def main(_):
with logger.benchmark_context(flags.FLAGS):
run_cifar(flags.FLAGS)
示例8: main
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def main(_):
with logger.benchmark_context(flags.FLAGS):
run_imagenet(flags.FLAGS)
示例9: main
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def main(_):
with logger.benchmark_context(flags.FLAGS):
run_transformer(flags.FLAGS)
示例10: main
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def main(_):
with logger.benchmark_context(FLAGS), \
mlperf_helper.LOGGER(FLAGS.output_ml_perf_compliance_logging):
mlperf_helper.set_ncf_root(os.path.split(os.path.abspath(__file__))[0])
run_ncf(FLAGS)
开发者ID:ShivangShekhar,项目名称:Live-feed-object-device-identification-using-Tensorflow-and-OpenCV,代码行数:7,代码来源:ncf_keras_main.py
示例11: main
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def main(_):
with logger.benchmark_context(flags.FLAGS):
run_movie(flags.FLAGS)
开发者ID:ShivangShekhar,项目名称:Live-feed-object-device-identification-using-Tensorflow-and-OpenCV,代码行数:5,代码来源:movielens_main.py
示例12: main
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def main(_):
model_helpers.apply_clean(flags.FLAGS)
with logger.benchmark_context(flags.FLAGS):
return run(flags.FLAGS)
开发者ID:ShivangShekhar,项目名称:Live-feed-object-device-identification-using-Tensorflow-and-OpenCV,代码行数:6,代码来源:ctl_imagenet_main.py
示例13: main
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def main(_):
with logger.benchmark_context(flags.FLAGS):
return run(flags.FLAGS)
开发者ID:ShivangShekhar,项目名称:Live-feed-object-device-identification-using-Tensorflow-and-OpenCV,代码行数:5,代码来源:resnet_cifar_main.py
示例14: main
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def main(_):
model_helpers.apply_clean(flags.FLAGS)
with logger.benchmark_context(flags.FLAGS):
stats = run(flags.FLAGS)
logging.info('Run stats:\n%s', stats)
开发者ID:ShivangShekhar,项目名称:Live-feed-object-device-identification-using-Tensorflow-and-OpenCV,代码行数:7,代码来源:resnet_imagenet_main.py
示例15: main
# 需要导入模块: from official.utils.logs import logger [as 别名]
# 或者: from official.utils.logs.logger import benchmark_context [as 别名]
def main(_):
with logger.benchmark_context(flags_obj):
run_deep_speech(flags_obj)