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