From 6d4ae00731cce8fc06002db46c6b62893384c41f Mon Sep 17 00:00:00 2001 From: Ruibiao Chen Date: Fri, 19 Aug 2022 17:24:49 +0800 Subject: [PATCH] Fix random op dependency and lr_shedule bugs for standalone executor (#45265) * Fix random op depenency and lr_shedule bugs for standalone executor * Fix CI errors * Fix CI errors * Fix CI errors --- .../interpreter/dependency_builder.cc | 26 +++++++++---------- python/paddle/fluid/executor.py | 2 ++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/paddle/fluid/framework/new_executor/interpreter/dependency_builder.cc b/paddle/fluid/framework/new_executor/interpreter/dependency_builder.cc index 4d005d0e883..7f4b52123fb 100644 --- a/paddle/fluid/framework/new_executor/interpreter/dependency_builder.cc +++ b/paddle/fluid/framework/new_executor/interpreter/dependency_builder.cc @@ -273,20 +273,18 @@ void DependencyBuilder::AddDependencyForCommunicationOp() { // make sure that the random op is scheduled sequentially void DependencyBuilder::AddDependencyForRandomOp() { - const std::set random_op_set = { - "bernoulli", - "poisson", - "multinomial", - "gaussian_random", - "truncated_gaussian_random", - "uniform_random", - "randint", - "randperm", - "exponential", - "sampling_id" - "dropout", - "class_center_sample", - }; + const std::set random_op_set = {"bernoulli", + "poisson", + "multinomial", + "gaussian_random", + "truncated_gaussian_random", + "uniform_random", + "randint", + "randperm", + "exponential", + "sampling_id", + "dropout", + "class_center_sample"}; int dependence_op_idx = -1; for (size_t op_idx = 0; op_idx < op_num_; ++op_idx) { diff --git a/python/paddle/fluid/executor.py b/python/paddle/fluid/executor.py index 218ee94a22b..440d2bfeb8e 100755 --- a/python/paddle/fluid/executor.py +++ b/python/paddle/fluid/executor.py @@ -1516,6 +1516,8 @@ class Executor(object): program._compile(scope, self.place) ir_graph = framework.IrGraph(program._graph) inner_program = ir_graph.to_program() + if hasattr(program._program, 'lr_sheduler'): + inner_program.lr_sheduler = program._program.lr_sheduler # print(f"Program after convert:\n {inner_program}", flush=True) logging.warning( "FLAGS_USE_STANDALONE_EXECUTOR and FLAGS_CONVERT_GRAPH_TO_PROGRAM is set to 1. Graph will be converted to Program and executed using new executor." -- GitLab