From 92001121e918946ec24f060eafeb5ad724fbf800 Mon Sep 17 00:00:00 2001 From: SunAhong1993 Date: Wed, 18 Nov 2020 15:25:25 +0800 Subject: [PATCH] fix the conflict --- x2paddle/core/program.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x2paddle/core/program.py b/x2paddle/core/program.py index 9c2a310..6da3476 100644 --- a/x2paddle/core/program.py +++ b/x2paddle/core/program.py @@ -490,11 +490,12 @@ class PaddleGraph(object): gen_codes( comment_list, indent=1)) + use_structured_name = False if self.source_type in ["tf", "onnx"] else True self.run_func.extend( gen_codes(["paddle.disable_static()", "params, _ = fluid.load_dygraph('{}/model')".format(code_dir), "model = {}()".format(self.name), - "model.set_dict(params)", + "model.set_dict(params, use_structured_name={})".format(use_structured_name),, "model.eval()", "out = model({})".format(input_data_name), "return out"], indent=1)) @@ -624,7 +625,7 @@ class PaddleGraph(object): paddle.disable_static() restore, _ = fluid.load_dygraph(osp.join(save_dir, "model")) model = getattr(x2paddle_code, self.name)() - if self.source_type == "tf": + if self.source_type in ["tf", "onnx"]: model.set_dict(restore, use_structured_name=False) else: model.set_dict(restore) -- GitLab