diff --git a/PaddleNLP/neural_machine_translation/transformer/predict.py b/PaddleNLP/neural_machine_translation/transformer/predict.py index 9a1a46916f32996ad8a26dc7af687c9e45747c61..d896517f9bf5e1f96b41856359501fe92fdc1402 100644 --- a/PaddleNLP/neural_machine_translation/transformer/predict.py +++ b/PaddleNLP/neural_machine_translation/transformer/predict.py @@ -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