未验证 提交 a546b663 编写于 作者: G Guo Sheng 提交者: GitHub

Fix transformer inference when using ParallelExecutor by setting...

Fix transformer inference when using ParallelExecutor by setting ExecutionStrategy to clear tensor array after each iteration. (#3374)
上级 ee882b53
......@@ -176,7 +176,11 @@ def do_predict(args):
pos_enc_param.set(
position_encoding_init(args.max_length + 1, args.d_model), place)
compiled_test_prog = fluid.CompiledProgram(test_prog)
exe_strategy = fluid.ExecutionStrategy()
# to clear tensor array after each iteration
exe_strategy.num_iteration_per_drop_scope = 1
compiled_test_prog = fluid.CompiledProgram(test_prog).with_data_parallel(
exec_strategy=exe_strategy, places=place)
f = open(args.output_file, "wb")
# start predicting
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册