From 9d6deb24a8a2e972bdb7b712f27c2b5d9f440193 Mon Sep 17 00:00:00 2001 From: jiangjiajun Date: Thu, 29 Aug 2019 20:22:51 +0800 Subject: [PATCH] add merge_params.py --- tools/merge_params.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tools/merge_params.py diff --git a/tools/merge_params.py b/tools/merge_params.py new file mode 100644 index 0000000..e6a8a3d --- /dev/null +++ b/tools/merge_params.py @@ -0,0 +1,16 @@ +import paddle.fluid as fluid +import sys + +model_dir = sys.argv[1] +new_model_dir = sys.argv[2] +exe = fluid.Executor(fluid.CPUPlace()) +[inference_program, feed_target_names, + fetch_targets] = fluid.io.load_inference_model(dirname=model_dir, executor=exe) + +print(feed_target_names) +fluid.io.save_inference_model(dirname=new_model_dir, + feeded_var_names=feed_target_names, + target_vars=fetch_targets, + executor=exe, + main_program=inference_program, + params_filename="__params__") -- GitLab