本文整理汇总了Python中runner.Runner方法的典型用法代码示例。如果您正苦于以下问题:Python runner.Runner方法的具体用法?Python runner.Runner怎么用?Python runner.Runner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类runner
的用法示例。
在下文中一共展示了runner.Runner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import runner [as 别名]
# 或者: from runner import Runner [as 别名]
def main():
print(header)
stream = open(args.config, 'r')
default = open('./configs/default.yaml', 'r')
parameters = load(stream)
default_parameters = load(default)
if(args.command == 'train'):
parameters = merge(default_parameters, parameters)
print("Training parameters\n-------")
print_dic(parameters)
runner = Runner(**parameters)
runner.run()
else:
parameters = merge(merge(default_parameters, parameters), {
'deterministic_evaluation': args.det,
'load_dir': args.load_dir
})
evaluator = Evaluator(**parameters)
evaluator.evaluate()
示例2: run
# 需要导入模块: import runner [as 别名]
# 或者: from runner import Runner [as 别名]
def run(unknown_arguments=False):
for file in [config.ticks_csv, config.network_csv, config.nodes_csv]:
utils.check_for_file(file)
parser = _create_parser()
if unknown_arguments:
args = parser.parse_known_args(sys.argv[2:])[0]
else:
args = parser.parse_args(sys.argv[2:])
logging.info("Parsed arguments in {}: {}".format(__name__, args))
utils.update_args(args)
_check_skip_ticks(args.skip_ticks)
context = Context()
logging.info(config.log_line_run_start + context.run_name)
tag = context.args.tag
if hasattr(context.args, 'tag_appendix'):
tag += context.args.tag_appendix
writer = Writer(tag)
runner = Runner(context, writer)
prepare = Prepare(context)
runner._prepare = prepare
postprocessing = PostProcessing(context, writer)
runner._postprocessing = postprocessing
event = Event(context)
runner._event = event
start = time.time()
runner.run()
logging.info("The duration of the run was {} seconds".format(str(time.time() - start)))