diff --git a/PaddleCV/PaddleGAN/trainer/CGAN.py b/PaddleCV/PaddleGAN/trainer/CGAN.py index f5d1f41750e065a61025ec937ae30b570cfccfe3..3e95ae36ede505425ab6109f6cc6ce9aadce5c28 100644 --- a/PaddleCV/PaddleGAN/trainer/CGAN.py +++ b/PaddleCV/PaddleGAN/trainer/CGAN.py @@ -111,9 +111,7 @@ class CGAN(object): utility.init_checkpoints(self.cfg, exe, g_trainer, "net_G") utility.init_checkpoints(self.cfg, exe, d_trainer, "net_D") - ### memory optim build_strategy = fluid.BuildStrategy() - build_strategy.enable_inplace = True g_trainer_program = fluid.CompiledProgram( g_trainer.program).with_data_parallel( diff --git a/PaddleCV/PaddleGAN/trainer/CycleGAN.py b/PaddleCV/PaddleGAN/trainer/CycleGAN.py index c66bc68fea8a503bf6c6f01a9a10f02953f52930..caa4a9d69f984c0bf123ffe69fd181c34b8a9528 100644 --- a/PaddleCV/PaddleGAN/trainer/CycleGAN.py +++ b/PaddleCV/PaddleGAN/trainer/CycleGAN.py @@ -279,9 +279,7 @@ class CycleGAN(object): utility.init_checkpoints(self.cfg, exe, d_A_trainer, "net_DA") utility.init_checkpoints(self.cfg, exe, d_B_trainer, "net_DB") - ### memory optim build_strategy = fluid.BuildStrategy() - build_strategy.enable_inplace = True gen_trainer_program = fluid.CompiledProgram( gen_trainer.program).with_data_parallel( diff --git a/PaddleCV/PaddleGAN/trainer/DCGAN.py b/PaddleCV/PaddleGAN/trainer/DCGAN.py index aed509b421178a7a96d2945569bdfd3692860ea9..a49e1ba9bdcd33d10691449e4baeb7675995a795 100644 --- a/PaddleCV/PaddleGAN/trainer/DCGAN.py +++ b/PaddleCV/PaddleGAN/trainer/DCGAN.py @@ -107,9 +107,7 @@ class DCGAN(object): utility.init_checkpoints(self.cfg, exe, g_trainer, "net_G") utility.init_checkpoints(self.cfg, exe, d_trainer, "net_D") - ### memory optim build_strategy = fluid.BuildStrategy() - build_strategy.enable_inplace = True g_trainer_program = fluid.CompiledProgram( g_trainer.program).with_data_parallel( diff --git a/PaddleCV/PaddleGAN/trainer/SPADE.py b/PaddleCV/PaddleGAN/trainer/SPADE.py index 5c427c4a1350e3e10f1afe8694da0ec10b1fd714..5a1f08053d71a59ecbfd1e2ede4df59b648c000a 100644 --- a/PaddleCV/PaddleGAN/trainer/SPADE.py +++ b/PaddleCV/PaddleGAN/trainer/SPADE.py @@ -323,9 +323,7 @@ class SPADE(object): utility.init_checkpoints(self.cfg, exe, gen_trainer, "net_G") utility.init_checkpoints(self.cfg, exe, dis_trainer, "net_D") - ### memory optim build_strategy = fluid.BuildStrategy() - build_strategy.enable_inplace = False build_strategy.sync_batch_norm = False gen_trainer_program = fluid.CompiledProgram( diff --git a/PaddleCV/PaddleVideo/train.py b/PaddleCV/PaddleVideo/train.py index 6ef853b580a20bd6110cfab298fb9030bef11f31..88ba38fbc59d15f3965704756365c7adf13ee4af 100644 --- a/PaddleCV/PaddleVideo/train.py +++ b/PaddleCV/PaddleVideo/train.py @@ -168,7 +168,6 @@ def train(args): train_model.load_pretrain_params(exe, pretrain, train_prog, place) build_strategy = fluid.BuildStrategy() - build_strategy.enable_inplace = True if args.model_name in ['CTCN']: build_strategy.enable_sequential_execution = True diff --git a/PaddleCV/deeplabv3+/train.py b/PaddleCV/deeplabv3+/train.py index e0a1f10b8d3caecf504b95230d4fa8ac9e2e9fd9..50ba81a6a3d276134b6d915d96d065012353eb78 100755 --- a/PaddleCV/deeplabv3+/train.py +++ b/PaddleCV/deeplabv3+/train.py @@ -199,7 +199,6 @@ exec_strategy.num_iteration_per_drop_scope = 100 build_strategy = fluid.BuildStrategy() if args.memory_optimize: build_strategy.fuse_relu_depthwise_conv = True - build_strategy.enable_inplace = True place = fluid.CPUPlace() if args.use_gpu: diff --git a/PaddleCV/image_classification/legacy/dist_train/dist_train.py b/PaddleCV/image_classification/legacy/dist_train/dist_train.py index 8cc226f312c00b7919dd82c1c8edab4117821024..f13202203f68b445b9815cd3e06112649dc500ac 100644 --- a/PaddleCV/image_classification/legacy/dist_train/dist_train.py +++ b/PaddleCV/image_classification/legacy/dist_train/dist_train.py @@ -284,7 +284,6 @@ def train_parallel(args): strategy.num_iteration_per_drop_scope = 30 build_strategy = fluid.BuildStrategy() - build_strategy.memory_optimize = False build_strategy.enable_sequential_execution = bool( args.enable_sequential_execution) diff --git a/PaddleCV/image_classification/utils/utility.py b/PaddleCV/image_classification/utils/utility.py index 46633aadda376a3cf7a2b922dc419b8c91a1cbb3..0ed642f3cf02a45380be513475a3f2e94c16664c 100644 --- a/PaddleCV/image_classification/utils/utility.py +++ b/PaddleCV/image_classification/utils/utility.py @@ -384,8 +384,6 @@ def best_strategy_compiled(args, program, loss): return program else: build_strategy = fluid.compiler.BuildStrategy() - #Feature will be supported in Fluid v1.6 - #build_strategy.enable_inplace = True exec_strategy = fluid.ExecutionStrategy() exec_strategy.num_threads = fluid.core.get_cuda_device_count() diff --git a/PaddleCV/rcnn/train.py b/PaddleCV/rcnn/train.py index 705ad33a0eeaa1e645d4e943ad2584de7c9dcd38..6be41aa04dc419bbf0a1483243f0106c660629e5 100644 --- a/PaddleCV/rcnn/train.py +++ b/PaddleCV/rcnn/train.py @@ -119,8 +119,6 @@ def train(): if cfg.parallel: build_strategy = fluid.BuildStrategy() - build_strategy.memory_optimize = False - build_strategy.enable_inplace = True exec_strategy = fluid.ExecutionStrategy() exec_strategy.num_iteration_per_drop_scope = 10 diff --git a/PaddleCV/ssd/train.py b/PaddleCV/ssd/train.py index 7bbb0fdaf6c80dbc5902690fdac916c622903c0e..3f126fb4f2e21605e2c3c5617c4e5dc4cf3a1f16 100644 --- a/PaddleCV/ssd/train.py +++ b/PaddleCV/ssd/train.py @@ -209,7 +209,6 @@ def train(args, if parallel: loss.persistable = True build_strategy = fluid.BuildStrategy() - build_strategy.enable_inplace = True train_exe = fluid.ParallelExecutor(main_program=train_prog, use_cuda=use_gpu, loss_name=loss.name, build_strategy=build_strategy) diff --git a/PaddleCV/yolov3/train.py b/PaddleCV/yolov3/train.py index 5f2284cf0c264e261c1cd6cab1a675c59b1981a7..5e4dfc8a7147299ebb0a9dab08d2410b94b6b378 100644 --- a/PaddleCV/yolov3/train.py +++ b/PaddleCV/yolov3/train.py @@ -111,7 +111,6 @@ def train(): fluid.io.load_vars(exe, cfg.pretrain, predicate=if_exist) build_strategy = fluid.BuildStrategy() - build_strategy.memory_optimize = False #gc and memory optimize may conflict syncbn = cfg.syncbn if (syncbn and devices_num <= 1) or num_trainers > 1: print("Disable syncbn in single device") diff --git a/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_record.py b/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_record.py index 7991d05d07679b4be3521458b3b4f7ea02186b4a..790e9e59872fe3420ee10098c581ee1373f6c8c4 100644 --- a/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_record.py +++ b/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_record.py @@ -398,8 +398,6 @@ def train(args): ema = fluid.optimizer.ExponentialMovingAverage(args.ema_decay) ema.update() - fluid.memory_optimize(train_program, skip_opt_set=[loss.name, num_seqs.name]) - if args.verbose: if args.in_tokens: lower_mem, upper_mem, unit = fluid.contrib.memory_usage( @@ -444,9 +442,6 @@ def train(args): if args.use_ema and 'ema' not in dir(): ema = fluid.optimizer.ExponentialMovingAverage(args.ema_decay) - fluid.memory_optimize(test_prog, skip_opt_set=[unique_ids.name, - start_logits.name, end_logits.name, num_seqs.name]) - test_prog = test_prog.clone(for_test=True) # if args.random_seed is not None: # test_prog.random_seed = args.random_seed diff --git a/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_record_twomemory.py b/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_record_twomemory.py index 5fd9fd5a688f0f84dd6d7f5aa76211d1738334a4..8762b17014d7aec32726a51b0974a94f667d89c1 100644 --- a/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_record_twomemory.py +++ b/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_record_twomemory.py @@ -426,8 +426,6 @@ def train(args): ema = fluid.optimizer.ExponentialMovingAverage(args.ema_decay) ema.update() - fluid.memory_optimize(train_program, skip_opt_set=[loss.name, num_seqs.name]) - if args.verbose: if args.in_tokens: lower_mem, upper_mem, unit = fluid.contrib.memory_usage( @@ -475,9 +473,6 @@ def train(args): if args.use_ema and 'ema' not in dir(): ema = fluid.optimizer.ExponentialMovingAverage(args.ema_decay) - fluid.memory_optimize(test_prog, skip_opt_set=[unique_ids.name, - start_logits.name, end_logits.name, num_seqs.name]) - test_prog = test_prog.clone(for_test=True) # if args.random_seed is not None: # test_prog.random_seed = args.random_seed diff --git a/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_squad.py b/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_squad.py index bf0a225bcae788fa3ce7333b9e8bfe86c463a562..46da820cae58472dcaca8d3585c86b063918bbb1 100644 --- a/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_squad.py +++ b/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_squad.py @@ -398,8 +398,6 @@ def train(args): ema = fluid.optimizer.ExponentialMovingAverage(args.ema_decay) ema.update() - fluid.memory_optimize(train_program, skip_opt_set=[loss.name, num_seqs.name]) - if args.verbose: if args.in_tokens: lower_mem, upper_mem, unit = fluid.contrib.memory_usage( @@ -444,9 +442,6 @@ def train(args): if args.use_ema and 'ema' not in dir(): ema = fluid.optimizer.ExponentialMovingAverage(args.ema_decay) - fluid.memory_optimize(test_prog, skip_opt_set=[unique_ids.name, - start_logits.name, end_logits.name, num_seqs.name]) - test_prog = test_prog.clone(for_test=True) # if args.random_seed is not None: # test_prog.random_seed = args.random_seed diff --git a/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_squad_twomemory.py b/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_squad_twomemory.py index 514ae51fa806392a783dd9a20063a44df585477e..18806744b1734daccc075624c4e9ce64a8b4ba41 100644 --- a/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_squad_twomemory.py +++ b/PaddleNLP/Research/ACL2019-KTNET/reading_comprehension/src/run_squad_twomemory.py @@ -426,8 +426,6 @@ def train(args): ema = fluid.optimizer.ExponentialMovingAverage(args.ema_decay) ema.update() - fluid.memory_optimize(train_program, skip_opt_set=[loss.name, num_seqs.name]) - if args.verbose: if args.in_tokens: lower_mem, upper_mem, unit = fluid.contrib.memory_usage( @@ -475,9 +473,6 @@ def train(args): if args.use_ema and 'ema' not in dir(): ema = fluid.optimizer.ExponentialMovingAverage(args.ema_decay) - fluid.memory_optimize(test_prog, skip_opt_set=[unique_ids.name, - start_logits.name, end_logits.name, num_seqs.name]) - test_prog = test_prog.clone(for_test=True) # if args.random_seed is not None: # test_prog.random_seed = args.random_seed diff --git a/PaddleNLP/dialogue_model_toolkit/auto_dialogue_evaluation/train.py b/PaddleNLP/dialogue_model_toolkit/auto_dialogue_evaluation/train.py index 0ee6ade59509d285e816b8311a0abdf24d807171..ac2a62f6a1cafe624cf95fba073b94e45996f717 100755 --- a/PaddleNLP/dialogue_model_toolkit/auto_dialogue_evaluation/train.py +++ b/PaddleNLP/dialogue_model_toolkit/auto_dialogue_evaluation/train.py @@ -122,7 +122,6 @@ def do_train(args): print("finish init word embedding ...") build_strategy = fluid.compiler.BuildStrategy() - build_strategy.enable_inplace = True compiled_train_prog = fluid.CompiledProgram(train_prog).with_data_parallel( loss_name=loss.name, build_strategy=build_strategy) diff --git a/PaddleNLP/dialogue_model_toolkit/dialogue_general_understanding/train.py b/PaddleNLP/dialogue_model_toolkit/dialogue_general_understanding/train.py index 2c4540a7bc1a9cdd08cc32c7d1e0b4a2323e99ce..dff5ef3bfa28f0425c6741d25b86917c9b1d6e5f 100644 --- a/PaddleNLP/dialogue_model_toolkit/dialogue_general_understanding/train.py +++ b/PaddleNLP/dialogue_model_toolkit/dialogue_general_understanding/train.py @@ -165,8 +165,6 @@ def do_train(args): save_load_io.init_from_pretrain_model(args, exe, train_prog) build_strategy = fluid.compiler.BuildStrategy() - build_strategy.enable_inplace = True - compiled_train_prog = fluid.CompiledProgram(train_prog).with_data_parallel( loss_name=loss.name, build_strategy=build_strategy) diff --git a/PaddleNLP/language_model/train.py b/PaddleNLP/language_model/train.py index 169c5c7089dd58f02de0a03b07949244081fc004..ad2d5fb6014aad94946549cb264f31845792934b 100644 --- a/PaddleNLP/language_model/train.py +++ b/PaddleNLP/language_model/train.py @@ -176,8 +176,6 @@ def main(): exec_strategy.num_iteration_per_drop_scope = 100 build_strategy = fluid.BuildStrategy() - build_strategy.enable_inplace = True - build_strategy.memory_optimize = False build_strategy.fuse_all_optimizer_ops = True if args.parallel: diff --git a/PaddleNLP/lexical_analysis/train.py b/PaddleNLP/lexical_analysis/train.py index 84eab37e8f13db672ee990be726d3f7788696812..dcc714702817cf75386974e6896fc9afbf6fd0e9 100644 --- a/PaddleNLP/lexical_analysis/train.py +++ b/PaddleNLP/lexical_analysis/train.py @@ -88,8 +88,6 @@ def do_train(args): exec_strategy = fluid.ExecutionStrategy() # exec_strategy.num_threads = dev_count * 6 build_strategy = fluid.compiler.BuildStrategy() - # build_strategy.enable_inplace = True - compiled_prog = fluid.compiler.CompiledProgram(train_program).with_data_parallel( loss_name=train_ret['avg_cost'].name, build_strategy=build_strategy, diff --git a/PaddleNLP/neural_machine_translation/transformer/train.py b/PaddleNLP/neural_machine_translation/transformer/train.py index 57fa3b91db165d88720b629ecd3e963266e27c60..14cd71e8154f075f11a160b58e7813dd3b711e40 100644 --- a/PaddleNLP/neural_machine_translation/transformer/train.py +++ b/PaddleNLP/neural_machine_translation/transformer/train.py @@ -233,7 +233,6 @@ def do_train(args): init_from_pretrain_model(args, exe, train_prog) build_strategy = fluid.compiler.BuildStrategy() - build_strategy.enable_inplace = True exec_strategy = fluid.ExecutionStrategy() if num_trainers > 1: dist_utils.prepare_for_multi_process(exe, build_strategy, train_prog) diff --git a/PaddleNLP/unarchived/neural_machine_translation/rnn_search/train.py b/PaddleNLP/unarchived/neural_machine_translation/rnn_search/train.py index 820c383a0682b61c728657cdc1349fcd46d5a650..561efd71ec7f6b40442ef32879187dbcf3e69580 100644 --- a/PaddleNLP/unarchived/neural_machine_translation/rnn_search/train.py +++ b/PaddleNLP/unarchived/neural_machine_translation/rnn_search/train.py @@ -126,8 +126,6 @@ def main(): exec_strategy.num_iteration_per_drop_scope = 100 build_strategy = fluid.BuildStrategy() - build_strategy.enable_inplace = True - build_strategy.memory_optimize = False # build_strategy.fuse_all_optimizer_ops = True if args.parallel: diff --git a/PaddleSlim/quant_low_level_api/quant.py b/PaddleSlim/quant_low_level_api/quant.py index c751cc4e7abe6a6bced91e5f46579fd89d5a17da..52def5337d038e1fdeec4a9c0ad5bf66d46a42d9 100644 --- a/PaddleSlim/quant_low_level_api/quant.py +++ b/PaddleSlim/quant_low_level_api/quant.py @@ -255,7 +255,6 @@ def train(args): load_persistable_nodes(exe, checkpoint, main_graph) build_strategy = fluid.BuildStrategy() - build_strategy.memory_optimize = False build_strategy.enable_inplace = False binary = fluid.CompiledProgram(main_graph.graph).with_data_parallel( loss_name=train_cost.name, build_strategy=build_strategy)